Originally posted by Zach71:
I have Flash CS5.5 and I am making a game on AS3. It is a stick person game. So the collision part of my question. How can I add it so when the character tries to go off the sidewalk how do I make it so collision is there. Could you give me a code snip where it allows for collision but is wrote for keyboard movement with the arrow keys.
My other question is how do i make it so when my guy walks off the stage it automatically goes to next frame.
If you are making a game where a character can walk up and down and if you want to restrict walkable area to only a sidewalk you can do it without collision for example:
var upPressed:Boolean = false;
var downPressed:Boolean = false; // Change these with keyboardEvent
///Put this into a loop///
if(downPressed && character.y > 400)
character.y += 2;
if(upPressed && character.y < 200)
character.y -= 2;
And if player walks out of the stage (to the right side)
if(player.x > 600)
////here remove all eventListeners