Hey, I quite new to lua and there are a few things that i cant get to work..
1.i have used the collsiion detection script as follows
function collisionCheck(object)
if (Player.x + playerWidth > object.x) and (Player.x < object.x + object.width) and (Player.y + playerHeight > object.y) and (Player.y < object.y + object.height) then
Player.x = oldx
Player.y = oldy
end
end
that works fine but when I try and use the same thing replacing Player with Enemy then Enemy just goes straight through it.
and also the following section doesnt work either:
if Player.y = Enemy.y and Player.x = Enemy.x then
screen:clear
screen:print(100,200,"you loose",red)
end
Please help
1.i have used the collsiion detection script as follows
function collisionCheck(object)
if (Player.x + playerWidth > object.x) and (Player.x < object.x + object.width) and (Player.y + playerHeight > object.y) and (Player.y < object.y + object.height) then
Player.x = oldx
Player.y = oldy
end
end
that works fine but when I try and use the same thing replacing Player with Enemy then Enemy just goes straight through it.
and also the following section doesnt work either:
if Player.y = Enemy.y and Player.x = Enemy.x then
screen:clear
screen:print(100,200,"you loose",red)
end
Please help