Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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;
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now