Note that there are some explanatory texts on larger screens.

plurals
  1. POAS3 Spawn Enemies in pattern
    primarykey
    data
    text
    <p>I was making a game in flash and I have a bit of an issue that I can't solve :S</p> <p>Lets say the enemies are spawning from left to right, and lets say we have 3 types of enemies.</p> <p>Right now I just write a for loop that generates amount of enemies of each type and places them in random position on the vertical scale (Math.random()*stage.stageWidth)</p> <p>Now it happends sometimes that enemies intersecting with each other plus the waves are never the same if you restart the game.</p> <p>I was thinking of the way to make a MovieClip like EnemyContainer and place therin manually enemies in formations or patterns and then controle them.</p> <p>Problem is that my Enemy class constructor uses arguments like reference to the stage and speed etc and if I just drop my objects in the movieclip I get errors because I can't define the stage at that point.</p> <p>Does anyone have an idea of how to make the waves of enemies with pattern?</p> <p>Here is the constructor of the Enemy:</p> <pre><code>public function Enemy(stageRef:Stage, firerate:Number=1000, speed:Number=1) { </code></pre> <p>As you can see it takes 3 args, but when droping movieclip of the Enemy in the EnemyContainer movieclip I have an error because you cant define the stage.</p> <p>Besides I am not sure if that idea with making one giant movieclip with patterns of enemies is the right way to do it.</p> <p>Another thing is my differnet enemies types are in one MovieClip enemy on differend frames and I can't control it either if I drop them in one movieclip</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload