dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: duplicate MC problems

  1. #1
    Junior Member
    Join Date
    Jul 2005
    Posts
    25

    duplicate MC problems

    I'm making a game that your character has to hit the goal, and. When the goal is hit it moves to a new spot and leaves a bullet behind.
    My preoblem is that the functions for the bullets only work on the bullet creates last
    code:

    function goalHit() {
    if (_root.char.hitTest(_root.goal)) {
    i += 1;
    duplicateMovieClip("bullet", "bullet"+i, i);
    bulletX = getProperty("_root.goal", _x);
    bulletY = getProperty("_root.goal", _y);
    _root["bullet"+i]._x = bulletX+10;
    _root["bullet"+i]._y = bulletY+10;
    _root.goal._x = Math.random()*400+120;
    _root.goal._y = Math.random()*380;
    trace(["bullet"+i]);
    }
    }


    function bullHit() {
    if (_root.char.hitTest(_root["bullet"+i])) {
    attachMovie("reset", "reset", resetLv);
    }
    _root.reset._x = 220;
    _root.reset._y = 200;
    }



    Also, I want the bullets to move when created and I haven't been able to get anything to work.

    If anyone has any ideas, thanks in advance.
    Attached Files Attached Files
    Last edited by drone002; 07-07-2005 at 11:40 PM.

  2. #2
    nobody
    Join Date
    Aug 2002
    Posts
    269
    I think you should use a counter variable that is defined on the root, and dont use duplicate but attachMovie. If it only works for the last created then the last one obviously overides the previous one...
    kra, kra

  3. #3
    Junior Member
    Join Date
    Jul 2005
    Posts
    25
    I don't know what you mean by "use a counter on the root level". And I still can't get any functions to work for the bullet.

    If anyone else can help I'd appreciate it.

  4. #4
    Junior Member
    Join Date
    Jul 2005
    Posts
    25
    Bump

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