Hello, hope I'm not bothering you but I just got one more question. In the map "smallRoom" I have the "#" representing the walls. I made it so you can move using the arrow keys and I was wondering if you knew how I'd make the walls solid so I don't just go through them. If you know what I mean. Here is the code:
--Default Stats--
dmg = "0"
def = "0"
int = "0"
per = "0"
acc = "0"
spe = "0"
health = "0"
mana = "0"
level = "0"
name = "nothing"
playing = false
posX = "0"
posY = "0"
--Classes Settings--
function mage()
dmg = "5"
def = "3"
int = "10"
per = "8"
acc = "4"
spe = "9"
health = "22"
mana = "45"
level = "1"
name = name
end
function paladin()
dmg = "9"
def = "7"
int = "4"
per = "7"
acc = "6"
spe = "5"
health = "35"
mana = "12"
level = "1"
name = name
end
function knight()
dmg = "12"
def = "7"
int = "0"
per = "0"
acc = "6"
spe = "6"
health = "40"
mana = "0"
level = "1"
name = name
end
function thief()
dmg = "7"
def = "5"
int = "5"
per = "2"
acc = "8"
spe = "12"
health = "25"
mana = "10"
level = "1"
name = name
end
function cleric()
dmg = "5"
def = "4"
int = "5"
per = "10"
acc = "3"
spe = "8"
health = "23"
mana = "40"
level = "1"
name = name
end
function archer()
dmg = "8"
def = "6"
int = "4"
per = "4"
acc = "11"
spe = "7"
health = "29"
mana = "10"
level = "1"
name = name
end
--End of Classes--
function freeMove() --This is my movement function--
while playing == true do
local event, key = os.pullEvent("key")
if key == keys.up then
term.setCursorPos(posX,posY)
print(" ")
posY = posY - 1
term.setCursorPos(posX,posY)
term.setTextColor(colors.orange)
print("^")
elseif key == keys.down then
term.setCursorPos(posX,posY)
print(" ")
posY = posY + 1
term.setCursorPos(posX,posY)
term.setTextColor(colors.orange)
print("V")
elseif key == keys.right then
term.setCursorPos(posX,posY)
print(" ")
posX = posX + 1
term.setCursorPos(posX,posY)
term.setTextColor(colors.orange)
print(">")
elseif key == keys.left then
term.setCursorPos(posX,posY)
print(" ")
posX = posX - 1
term.setCursorPos(posX,posY)
term.setTextColor(colors.orange)
print("<")
end
if playing == false then
break
end
end
end
term.clear()
term.setCursorPos(17,1)
print("Character Design")
sleep(1)
term.setCursorPos(2,3)
write("Character Name: ")
name = read()
term.clear()
--Race Selection--
write("Select a race: ")
race = read()
if race == "human" then
term.clear()
elseif race == "hafling" then
term.clear()
elseif race == "elf" then
term.clear()
elseif race == "orc" then
term.clear()
elseif race == "drow" then
term.clear()
else
print("Invalid Race!")
sleep(1)
print("Please run program: races for the list of playable races.")
sleep(2.5)
term.clear()
shell.run("mud")
end
--Class Selection--
write("Select a class: ")
class = read()
if class == "mage" then
mage()
term.clear()
elseif class == "paladin" then
paladin()
term.clear()
elseif class == "knight" then
knight()
term.clear()
elseif class == "thief" then
thief()
term.clear()
elseif class == "cleric" then
cleric()
term.clear()
elseif class == "archer" then
archer()
term.clear()
else
print("Invalid Class!")
sleep(1)
print("Please run program: classes for the list of playable classes.")
sleep(2.5)
term.clear()
shell.run("mud")
end
--End Of Character Creation / Stats--
function drawStats()
term.setCursorPos(17,1)
print(name, " the ", race, " ", class, "!")
term.setCursorPos(1,3)
print("Damage: ", dmg)
print("Defence: ", def)
print("Intelligence: ", int)
print("Personality: ", per)
print("Accuracy: ", acc)
print("Speed: ", spe)
print("Health: ", health)
print("Mana: ", mana)
end
function load(name)
local file = fs.open(name,"r")
local data = file.readAll()
file.close()
print(data)
end
drawStats()
term.setCursorPos(22,10)
print("Please wait...")
sleep(4)
term.clear()
term.setCursorPos(1,1)
print(name, " awoke in a small room...")
sleep(2)
print("It was cold, all of ", name, "'s supplies have been stolen...")
sleep(3)
term.clear()
--Area 1: Small Room--
load("smallRoom")
playing = true
term.setCursorPos(25,9)
term.setTextColor(colors.orange)
print("^")
posX = "25"
posY = "9"
freeMove()
This is a screenshot I took of the program running, the arrow being the character. When you move right it changes to > etc… hope this helps.