|
-
Prevent movement off screen
Hi,
I curretnyl have this code for moving a character left and right on the stage:
onClipEvent (load) {
speed = 15;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
_x -= speed;
_xscale = -100;
}
if (Key.isDown(Key.RIGHT)) {
_x += speed;
_xscale = 100;
}
}
Is there a way I can make it so that when the player reaches a certain point at the ede of the screen it will prevent them from moving further i nthat direction (perhaps something where once it reaches a certain distance to the left then only the right key will work)
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|