Zitat von mraellis
Ok I've been doing the evil mana tutorials. I've kinda hit a snag at number 6 and cant work out why..
here's the code.
-- ******* Tables ********
oldpad = Controls.read()
green = Color.new(0,255,0)
red = Color.new (255,0,0)
blue = Color.new (0,0,255)
currentEnemy = 1
Enemy = { }
Enemy[1] = { type = "gargoyle", health = 100 }
Enemy[2] = { type = "vampire", health = 100 }
Enemy[3] = { type = "goomba", health = 100 }
Enemy[4] = { type = "ghost", health = 100 }
Enemy[5] = { type = "zombie", health = 100 }
Player = { }
Player[1] = { weapon = "sword", health = 100 }
Player[2] = { weapon = "knife", health = 100 }
-- *****Main Loop******
while true do
pad = Controls.read()
screen:clear()
screen:print(5,10,"Player 1 Health: " .. Player[1].health,red)
screen:print(5,20,"Player 1 Weapon: " .. Player[1].weapon,blue)
screen:print(250,10,"Enem y Health: " .. Enemy[currentEnemy].health,green)
screen:print(250,20,"Enem y Type: " .. Enemy[currentEnemy].type,green)
if currentEnemy == 5 and Enemy[currentEnemy].health == 0 then
screen:print(50,100,"All enemies are dead",red)
end
if Enemy[currentEnemy].health == 0 and currentEnemy <= 4 then
currentEnemy = currentEnemy + 1
end
if pad:cross() and oldpad:cross() ~= pad:cross() and Enemy[currentEnemy].health > 0 then
Enemy[currentEnemy].health = Enemy[currentEnemy].health - 5
screen.waitVblankStart()
screen.flip()
oldpad = pad
end
------------------------------------------------
cant work out how to put it in one of them code boxes... someone tell me how and i'll edit it ;)
anyway the error is at line 24 which i made that area bold.. cant see the prob though.
thx in advance.