Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

AS3 game problems.

New Here ,
May 19, 2013 May 19, 2013

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.

TOPICS
ActionScript
310
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 19, 2013 May 19, 2013
LATEST

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;

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines