Saturday, May 19, 2012

[Action Script] [AS2] How can I change my characters coordinates? May,2012

Ok, so for my class I have decided to make a game in flash, but i'm not used to flash code.
This is what I have so far, but i'm trying to make it so once the character makes it to the opposite side of the screen, or once his x coordinate is more than 500, his x coordinate gets reset to 0, so he like warps back. I need help, Thanks.

onClipEvent (enterFrame) {
if (Key.isDown(Key.UP))
{
_y -= 10;
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.DOWN))
{
_y -= -10;
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT))
{
_x -= 10;
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT))
{
_x -= -10;
}
}

onClipEvent (enterFrame)
{
if (player._x >= 550)
{
player._x == 0;
}
}
[AS2] How can I change my characters coordinates?

Related Post



0 comments: