A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Missiles Within Movieclips

  1. #1
    Junior Member
    Join Date
    Dec 2007
    Posts
    10

    Missiles Within Movieclips

    I have a Helicopter MC that i want to shoot a missile when a button is pressed but when it shoots and the helicopter moves the missile moves with the helicopter still, is there anyway that i can fix this, i've tried putting the missiles on a different layer but then they don't move with the helicopter.

    PLEASE HELP!!!

    thanks
    Blair3113

  2. #2
    Junior Member
    Join Date
    Jul 2007
    Location
    Glasgow, Scotland
    Posts
    18
    Hi Blair. You really should treat the missiles as different MovieClips (or Sprites, if you're working with ActionScript 3). I'll assume you're using AS2.

    Have you tried attaching a new missile MovieClip each time the 'fire' button is pressed, and keeping track of the layer (or depth) the previous bullet was placed at? You could then name each missile MovieClip according to the depth it'll be getting placed at, as follows:

    attachMovie("missile", "missile"+depthCounter, depthCounter);
    depthCounter++;
    After each time you add a missile, you increment the depthCounter. That way, you never get a missile on the same depth as another missile. Better still than just naming each missile according to its depth, you should store references to the missiles, as they are created, in an array. Then, you can run through that array, checking whether the missiles are still in the game bounds, etc. - let me know how it goes, though.

  3. #3
    Junior Member
    Join Date
    Dec 2007
    Posts
    10
    THANKS HEAPS, i am using AS2 by the way

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center