3 Replies Latest reply on May 8, 2007 10:28 AM by gooberachi

    Making my enemies drop bombs in space invaders

    gooberachi
      Hi all,

      I'm in the process of learning flash just now and am completing an online tutorial on Space Invaders. Thing is, the bombs drop from a random location on the screen. I want them to drop from a random enemy (I'm not too bothered just now about making it one on the bottom row or one with no other enemies before them).

      At the moment, here is the AS that makes them drop (the frequency is determined elsewhere):

      eval("_root.alienBomb" + alienBombNum)._x =random(700);
      eval("_root.alienBomb" + alienBombNum)._y = 300*Math.random();

      An I can modify it to get a certain one to drop:

      eval("_root.alienBomb" + alienBombNum)._x =_root.alienClip2_2._x;
      eval("_root.alienBomb" + alienBombNum)._y = _root.alienClip2_2._y;

      I can' t get it to randomly choose one - I know I have to use the random function, but don't know how to implement this.

      Can anyone help?

      regards,

      g