A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: Dupilcate Movie Clip + Hit test

  1. #1
    Junior Member
    Join Date
    Dec 2000
    Posts
    13

    Post

    please help
    i stuck with duplicte movie clip(DMC)and hit test

    I am creating Partical Motion Game where partiacal collides with each other and No. of parical Are user defined, The problem is how to detect collusion between duplicate movie clip any body please help me


    Mac007x

  2. #2
    Senior Member Mad-Sci's Avatar
    Join Date
    Mar 2000
    Posts
    2,756
    Hi, keep in mind for the so called explosive growth when you try to do collision detection for each element this might crash your computer if you put too many particles or will slow down definetely. Anyway:

    keep a variable wich will point the number of particles:
    do a loop inside each particle to check for collision with hitTest()

    myNumber=5; for example this is the 5th particle
    for (i=1,i<numPart,i++){
    if ( i==myNumber ){ i=i+1;}- dont check collision with myself
    hitTest ( _root["particle" add i])){

    ===============
    actions go here
    ===============

    }}

    hope this helps
    mad_sci

    PS I would also suggest if you give each particle life using GetTimer. In other words remove the particle after a while.

  3. #3
    Junior Member
    Join Date
    Dec 2000
    Posts
    13
    Thank U for help but it`s not working here is code for
    buttion that having following Action for (DMC)


    on (release) {
    if (i<100) {
    i++;
    top++;
    }
    duplicateMovieClip ("Block", "Block"+i, i);
    setProperty ("Block"+i, _x, Random(408)+60);
    setProperty ("Block"+i, _y, Random(471)+30);
    }

    -------------------
    Now where should i put Action who i will get New name for movie clip please help me

    I think u Can help me .............:-)

    So,

    Waiting For Reply

    Mac007x


    [Edited by mac007x on 01-22-2001 at 09:23 AM]

  4. #4
    Junior Member
    Join Date
    Jan 2001
    Posts
    3

    ...

    i am having the same problem as you. It is that once you create a bunch of numbered duplicated movie clips it is hard to find out which numbered one has been affeted. I am trying to investigate the eval() function that seems to return the value of the spacific mc.

  5. #5
    Junior Member
    Join Date
    Jan 2001
    Posts
    3

    oh yeah ...

    you can also refere to each new mc as
    ["block"+i]
    or maybe,
    _root["block"+NUMBER]
    I wan to find out dynamicly which one has been hit.

  6. #6
    Junior Member
    Join Date
    Dec 2000
    Posts
    13

    Post

    yes good input i will try that, i think you also try
    let's hope it will work, if it's work please contact me nikku where is mad-sci i am waiting for answer..

    waiting for solution

    mac007x


  7. #7
    Junior Member
    Join Date
    Jan 2001
    Posts
    21
    Yeah, I have a very similar problem myself.

    Duplicating a movie clip I'm using for a projectile, I have to check when a movie collides with the character movie clip. I've tried various methods of using hitTest, including putting the command inside the projectile clip to be copied, but I cannot get a result.

    Any suggestions?

  8. #8
    Senior Member Mad-Sci's Avatar
    Join Date
    Mar 2000
    Posts
    2,756
    Hi guys somehow I missed this post. Sorry about it ok down to busness:

    mac007x code:
    ============
    on (release) {
    if (i<100) {
    i++;
    top++;
    }
    duplicateMovieClip ("Block", "Block"+i, i);
    setProperty ("Block"+i, _x, Random(408)+60);
    setProperty ("Block"+i, _y, Random(471)+30);
    }
    replace with:
    -------------


    on (release) {
    while (i<100) {
    i++;
    top++;
    duplicateMovieClip (_root.Block,_root["Block" add i],100+ i);
    setProperty (_root["Block" add i] , _x, Random(408)+60);
    setProperty (-root["Block" add i] , _y, Random(471)+30);

    }
    }

    How that works ?

    mad_sci

  9. #9
    Junior Member
    Join Date
    Dec 2000
    Posts
    13
    i don't understand it is not working ??

    hi thankx but i tried but not working but it should work
    after export it's taking too much of time and after clicking on bution Stage is moving toward movie clip mut it is not duplicating i don't no what is happeing in code

    I will try to host the .FLA file So Anybody can see and understand our problem isn't it "niiku", "The_Offspring"..

    See u soon

    Mac007x

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