A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: (more) Bullet holes on mouse down!!

  1. #1
    Junior Member
    Join Date
    Oct 2001
    Posts
    7
    hey guys ... coincidently I've als been trying to get bullet holes on mouse down on a preloader I've been working on. Firstly let me say great work with the scripting. It works a treat :-) I have one small problem however. The bullet holes work fine while the preloader is running but the problem is they are still there when my movie jumps to the next scene. They just sit on top of the next scene! Any ideas?

  2. #2
    Senior Member
    Join Date
    Mar 2000
    Location
    New York, New York
    Posts
    124
    Well, if you have used my way of attaching the bullet holes by using the "attachMovie" comand, and you included the "n" variable, it would be really easy to remove the MCs. Because the "n" variable gave each new instance of the bullet hole graphic an individual name, you can creat a loop to romove them, it would look something like this...

    loop ( _root.n > 0){
    removeMovieClip (_root["bull" add _root.n], 1+ _root.n);
    _root.n --
    }

    I am not very good with loops so you may have to fiddle around with this to get it to work right, but that is the what you should be going for. The loop takes the varibale "n" representing the number attached to the MC "bull" and removes it from the stage, then subracts from the variable "n" again. So if "n" eq 25, that means you have 25 instances of the bullet graphic on the stage named, "bull1" bull2" "bull3" ect ect ect. It just simply counts down from there... I hope that makes sence.


  3. #3
    Junior Member
    Join Date
    Oct 2001
    Posts
    7
    Thanks Jesse ... but I'm not having any luck. I've put in the code and it stops the mouse trailer on me and I get the following output message:

    Wrong number of parameters; removeMovieClip requires exactly 1.
    removeMovieClip (_root["bull" add _root.n], 1+_root.n);

  4. #4
    Senior Member
    Join Date
    Mar 2000
    Location
    New York, New York
    Posts
    124
    Yeah sorry for that, I am not sure how to work that loop, like I said I am not very good at stringing loops to gether... Unfortunatly I am going away for the weekend and I will not be back untill monday, maybe on monday I will have a chance to look at the code and get it to work then repost it for you. You can always do it the hard way and just manually remove the bullet holes... the only problem is you would have about 20 or so lines of removemovie cip comands assuming you limit the number of bullet holes at 20. Sorry I am not being much of a help today, but on monday I will make sure I get it to work fo ryou ok?


  5. #5
    Senior Member
    Join Date
    Apr 2001
    Posts
    257

    i got it

    just put this in as a frame action in scene 2

    Code:
    while (_root.n >0) {
        removeMovieClip (_root["bull" add _root.n]);
        _root.n --;
    }

  6. #6
    Junior Member
    Join Date
    Oct 2001
    Posts
    7

    Re: i got it

    Thanks "Veryevil" it worked a treat.. you guys are legends. ...Virtuoso, you can have monday off :-)

  7. #7
    Hi guys... and how would you do it to remove each 'bull+n' movie clip after a while?

    What I figured on my own: (excuse my scripting please)

    Code:
    //I start 'n' count again with a variable named 't' because
    'n' value at this point will be higher than 0 (or 1)
    _root.t=0;
    while (_root.t<=_root.n){
      set some timer.....  when time's up
         removeMovieClip (_root["bull" add _root.t]);
        _root.t++;
    }
    Is this OK??? I haven't tryed it 'cause I don't know about timers.....yet

  8. #8
    Senior Member
    Join Date
    Apr 2001
    Posts
    257

    it is this

    all you have to do is this!!!!

    Code:
    onClipEvent (enterFrame) {
        if (_root.n == 20) {
            _root.n = 0;
        }
    }
    so when n is 20 n is reset to 0 so it then duplicates on depth n so it removes the first one and adds the new one!!! but it will not work with the remove thing i posted a bit a go!!! as n is already reset

  9. #9
    Yeah, but that would not make'em dissappear by themselves (not by themselves, but after an amount of time), and that was what I was trying to acheive.

    but it will not work with the remove thing i posted a bit a go!!! as n is already reset
    and that is exactly why I used a new variable (t instead of n), so the 'remove thing' will still work if not all the bullets were removed by the time you leave the scene....



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