dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Collision problem

  1. #1
    Member
    Join Date
    Mar 2003
    Posts
    34

    Collision problem

    Please see attached .FLA

    I want the build1 MC to go to the frame label blast (which is inside it) when the rocket MC hits it.

    Why wont it work? Please help!!
    Attached Files Attached Files

  2. #2
    Senior Member studioqtopia's Avatar
    Join Date
    Nov 2003
    Location
    California
    Posts
    582
    not sure what effect u'r looking for but...
    u can use a hittest in an onClipEvent on the rocket mc like this:
    onClipEvent (enterFrame) {
    if(this, hittest(_parent.build1)){
    _parent.build1.gotoAndPlay("blast");
    }
    }
    see attached file...
    sean
    Attached Files Attached Files

  3. #3
    Member
    Join Date
    Mar 2003
    Posts
    34
    Thats great, I can get started properly now. Thanks for your time and skills.

  4. #4
    Member
    Join Date
    Mar 2003
    Posts
    34
    Hmm, reached another problem. How can I have multiple instances of the Mc 'build1' and have them all react to 'Rocket'? I want the player to be able to place multiple squares on the movie and have them all explode when hit by 'rocket'. Any ideas?

  5. #5
    Senior Member studioqtopia's Avatar
    Join Date
    Nov 2003
    Location
    California
    Posts
    582
    ok, then move the hittest to the build1 mc. i first nested the build1 mc in another mc so that the actions i place on the build1 mc will be stored on all instances when copied or duplicated. the code on the nested build1 mc will now look like this:
    onClipEvent (enterFrame) {
    if(this, hittest(_parent._parent.rocket)){
    this.gotoAndPlay("blast");
    }
    }
    note that the mc that is holding the build1 mc will need to have unique instance names from eachother otherwize they will all react to a single hittest. so u'll need to use a "for" loop when dynamically duplicating or attaching mc's like:
    for(i=1; i<5;i++){
    _root.buildSprit.duplicateMovieClip(("buildSprit"+ i),i);
    }
    not sure what or how u'r game/project works or what's supposed to happen but you'll also need to dynamically place the newly duplicated or attached mc's on the stage.

    sean
    Attached Files Attached Files

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