Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Push a player back when he is hurt?

Name: Anonymous 2010-04-07 14:40

Hello programmers! I am having a tad bit of trouble with my lua code, I am trying to make the play go in the opposite direction (about 5 pixels back) when he is hurt by an enemy or sharp object.

basically like in the older snes and gameboy version of zelda.
The problem is that it keeps going and going until it goes off the screen into oblivion. Anyone know how to get this working correctly?

function playerDirection()
if Player[1].state == 2 and Player[1].hurt == 1 then
Player.x = Player.x + 5
local sound = hurt_01
voice = sound:play()
end
if Player[1].state == 3 and Player[1].hurt == 1 then
Player.x = Player.x - 5
local sound = hurt_01
voice = sound:play()
end
if Player[1].state == 1 and Player[1].hurt == 1 then
Player.y = Player.y + 5
local sound = hurt_01
voice = sound:play()
end
if Player[1].state == 0 and Player[1].hurt == 1 then
Player.y = Player.y - 5
local sound = hurt_01
voice = sound:play()
end
end

Name: Anonymous 2010-04-07 14:44

Hello programmers!
HELLO MOTHERFUCKER
GET ACQUAINTED WITH MY FRIEND
I CALL HIM THE [code] TAG

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List