Skip to main content
Participant
May 20, 2013
Question

AS3 game problems.

  • May 20, 2013
  • 1 reply
  • 323 views

I have a movie clip (example_mc) that is controlled by arrow keys and keyboard events,

the only problem is: when my Movie clip hits the side of the screen, he keep going. if there is a code for Example_mc to reset to the same x but different y (I want it to reset to the other side of the screen, allowing it to run infinitely in one direction whilst staying on screen)

thanks.

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
May 20, 2013

You need to implement a simple conditional that checks the mc's y position.  If the value is greater than the screen height, then reset it to the the value at the top of the screen.

Within whatever code you have that moves the mc, use something like:

if(Example_mc.y > stage.stageHeight){

    Example_mc.y = 0;

}