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

Spawning Enemies to Stage in Flash AS3

New Here ,
May 17, 2011 May 17, 2011

Copy link to clipboard

Copied

I have the enemies appearing on my stage  and spawning accordingly.  I have the location on where I want them to  spawn. The problem is that they are spawning on the first frame of my  game which is the main menu before entering the actual playing field. Not the second frame where my game commences.

How can i go about  this?

I tried this command and it just starts the game on the second frame.

I wrote this code within my createEnemy function.

   createEnemy.start(2);

        function commenceGame():void
        {
               
                //Sliding Duck Objects
                enemy = 1000;
                enemyTimer = new Timer(1000, enemy);
                enemyStorage = new MovieClip();
                addChild(enemyStorage);
                enemyTimer.addEventListener(TimerEvent.TIMER,createEnemy);
                enemyTimer.start();
               
                cursor = new Cursor();
                addChild(cursor);
                cursor.enabled=true;
                Mouse.hide();
                stage.addEventListener(MouseEvent.MOUSE_MOVE,shiftCursor);
        }

        //Creates Enemies on the Stage
        function createEnemy(event:TimerEvent):void
        {
                var enemyAppear = new MovieClip;
                enemyAppear = new Enemy();
                enemyAppear.x = 245;
                enemyAppear.y = 285;
                enemyStorage.addChild(enemyAppear);
               
        }

          commenceGame();

Hope this is enough code of my game to determine how to go about what I request.


Thanks Casey

TOPICS
ActionScript

Views

3.8K
Translate

Report

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

correct answers 1 Correct answer

LEGEND , May 17, 2011 May 17, 2011

If you don't want the enemiies to be generated until you are in frame 2, then put the enemy generating code in frame 2.

Votes

Translate
LEGEND ,
May 17, 2011 May 17, 2011

Copy link to clipboard

Copied

If you don't want the enemiies to be generated until you are in frame 2, then put the enemy generating code in frame 2.

Votes

Translate

Report

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
New Here ,
May 17, 2011 May 17, 2011

Copy link to clipboard

Copied

LATEST

Cool thanks that works perfectly appreciate it!

Votes

Translate

Report

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