Sunday, 22 May 2011

she's alive! oh wait no...

I have encountered a bug today where Shay seemed to be able to use her attack animation after she'd died!
I have now found a work around to remove this zombie activity!

The confusing jargon bit:
I'd originally set up a direct "when Ctrl is pressed have Shay play her attack animation"
however once she was dead the player could still press Ctrl and she'd still play the animation!
The work around:
I've now modified it so at the start of the game i have a value set to 0.
when Ctrl is pressed it now adds 2 to this value (instead of animating shay).
i set up an "if" for "if this value = 2" (which it will be after pressing Ctrl)
play the attack animation and subtract 2 from the value (resetting it to 0)

so in short it works like a toggle, Ctrl is pressed making the value 2, making the animation play and then resetting the value to 0.

i also set up another "if" for "if Shay's lives = 0 (meaning she is dead) set the value to 10.
so then pressing Ctrl once she is dead will set value to 12 making nothing happen.

a complicated but effective work around!

i've also added a "game over screen" with the words "you are dead!" as a nudge towards this old classic gameover!
the game over screen will activate 4 seconds after shay dies, and last for 4 seconds before restarting the level.

No comments:

Post a Comment