A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [MX04] Collision detection between instances

Threaded View

  1. #1
    Junior Member
    Join Date
    May 2007
    Posts
    2

    [MX04] Collision detection between instances

    Help! I've been all over this site, and the forum, and I'm completely stuck. I don't normally ask for help but I'm getting a bit despirate now!

    I'm making a falling-block game, similar to connect four/four in a row, and I'm trying to figure out how to do collision detection between each of the boxes I'm using so that once one hits the block below it it stops. They're all instances of one movie clip (box_mc). Once a block has fallen, the player then controls the next block and so on (this bit works fine), so the code has to go in the actions layer.

    I'm not very good at Flash yet...so if someone could give me an idea on what I need to do for this, or a tutorial I can use (the one on here is very good, but confused me to no end and I couldn't get it working), I'll be very grateful!

    Thanks for looking.

    EDIT: this is what I'm trying;

    targetBox = _root["box"+_root.currentBox];
    multipleHit = function() {
    boxNum = targetBox.length;
    for (i=0; i>boxNum; i++) {
    _root["box"+_root.currentBox] = targetBox[i];
    for (j=0; j<targetBox; j++) {
    boxCollision = targetBox[j];
    _root["box"+_root.currentBox] = eval(_root["box"+_root.currentBox]);
    boxCollision = eval(boxCollision);
    if (_root["box"+_root.currentBox].hitTest(boxCollision)) {
    _root["box"+_root.currentBox].stop();
    Last edited by NekoMalik; 05-24-2007 at 05:43 AM.

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