This is what I think my problem is:
Code: Select all
if pad:r() and oldpad:r() ~= pad:r() and currentWeapon == 1 then
currentWeapon = 2 else
currentWeapon = 1
end
Code: Select all
green = Color.new(0,255,0)
red = Color.new(255,0,0)
blue = Color.new(0,0,150)
white = Color.new(200,200,200)
currentEnemy = 1
currentWeapon = 1
currentPlayer = 1
pad = Controls.read()
oldpad = Controls.read()
Enemy = {}
Enemy[1] = { type = "Fireman" , health = 100 }
Enemy[2] = { type = "Iceman", health = 100 }
Enemy[3] = { type = "Gutsman", health = 100 }
Enemy[4] = { type = "Elecman", health = 100 }
Enemy[5] = { type = "Cutman", health = 100 }
Player = {}
Player[1] = { name = "Rockman" , health = 100 }
Player[2] = { name = "Blues" , health = 100 }
Weapon = {}
Weapon[1] = { weapon = 5 , name = "Rockbuster" }
Weapon[2] = { weapon = 20 , name = "Charged Shot"}
while true do
screen:clear()
screen:print(5,10, Player[currentPlayer].name .. "s Health: " .. Player[currentPlayer].health,green)
screen:print(5,20, Player[currentPlayer].name .. "s Weapon: " .. Weapon[currentWeapon].name,green)
screen:print(250,20,"Enemy Name: " .. Enemy[currentEnemy].type,red)
screen:print(250,10,"Enemy Health: " .. Enemy[currentEnemy].health,red)
screen:print(90, 40,"Press [X] to Attack!!!",white)
if currentEnemy == 5 and Enemy [currentEnemy].health == 0 then
screen:print(100,100,"All RobotMasters have been Killed!",blue)
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 - Weapon[currentWeapon].weapon
end
if pad:r() and oldpad:r() ~= pad:r() and currentWeapon == 1 then
currentWeapon = 2 else
currentWeapon = 1
end
screen.waitVblankStart()
screen.flip()
oldpad = pad
pad = Controls.read()
if pad:start() then
break
end
end
P.S.
Also, If its not to hard, can anyone tell me instead of just making the enemies health go down right when you press "X", that a picture(bullet) moves from your current location straight to the last direction you were facing and then if it hits another picture (enemie) that the "health" variable goes down.? and yes... I do love Rockman (Megaman)... THANKS~!