dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: COLLISION!!! I NEED HELP!!!!!

  1. #1
    Member
    Join Date
    Nov 2001
    Posts
    61
    I finally figured out how to do collision but I still have a slight problem. I'm making a skateboarding game. Their are garbage cans(mc) which come towards the skater(another mc). If the skater hits them, he falls off his skateboard. My problem is that when he hits the cans, the first few frames of the animation of him falling repeat untill he doesn't touch the can at all. So basically I want it so that when the skater hits the garbage can, the animation of him falling off continues even if he's still touching the can. I know it's complicated to understand but pleaaaaaaaase try.
    Here's a link to a site where it's posted:
    http://www.rtl.nl/games/entertainmai...html?movid=445

    also, this is the code that is on the first frame of the garbage can mc:

    flag = this.hitTest("/skater");
    if (flag == true) {
    tellTarget ("/") {
    gotoAndStop ("hit");
    }
    }
    if (flag == true) {
    tellTarget ("/skater") {
    gotoAndPlay (2);
    }
    }

    thanks a lot



  2. #2
    Old dog learning new tricks

    Join Date
    Dec 2000
    Posts
    1,498
    Create a variable in the main timeline to declare if the skater is fallen or not.
    In the beggining of the movie:
    _root.fallen="no";
    Then in the if statement:
    if (flag == true && _root.fallen=="no") {
    tellTarget ("/skater") {
    gotoAndPlay (2);
    _root.fallen="yes";
    }
    }
    In the last frame of the falling animation:
    _root.fallen="no";

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