dcsimg
A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: game scripting help!!!

  1. #1
    var x:Number = 1; x /= 0;
    Join Date
    Dec 2004
    Posts
    549

    game scripting help!!!

    I NEED HELP!!!! i am trying to make a game where you are looking down into a pond, and you see the reflection of a palm tree hanging over the pond. you control a little black spot in the pond, and try to catch the falling water droplets that fall from the tree.i have the rectangle for the collision detection, and i made the spot follow the cursor, but i don't know how to script collision detection. i also don't know how i should make the water droplet fall, anfd still let it have properties. animations don't have properties.i tried that first. i also tried another movie, but i'm not sure if i can link the scripts in the seperate movies...or if i have to!


    please help me!!

  2. #2
    Senior Member cyber reaper's Avatar
    Join Date
    Apr 2004
    Location
    israel
    Posts
    272
    ok im not sure as for the drops but i can help you with the collision reaction , just take a look at my attached file
    ok....what ?

  3. #3
    var x:Number = 1; x /= 0;
    Join Date
    Dec 2004
    Posts
    549
    i can't open it

    can you just give me the code for how to do collision detection between an object called drop_target and an object called spot_target?

  4. #4
    Senior Member cyber reaper's Avatar
    Join Date
    Apr 2004
    Location
    israel
    Posts
    272
    basicly its this :

    if (first element.colideRect (second element)){
    one of the elements.action
    }
    ok....what ?

  5. #5
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    the hardest part of collision dection is always dealing with the fact that once they collide they are continuing to collide and you need to deal with this.

    You can either move them apart once collided, remove one object or both. Or somehow test for the collision and then set a flag variable to true and only recheck for collision when this is no longer true, or no longer colliding.

    Hope that makes sense.

  6. #6
    var x:Number = 1; x /= 0;
    Join Date
    Dec 2004
    Posts
    549
    yes, it does. thank you. you have been a big help

  7. #7
    var x:Number = 1; x /= 0;
    Join Date
    Dec 2004
    Posts
    549
    only one other thing.....

    when you said one of the elements.action
    did you mean ANY element, or only one of the targets?

  8. #8
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Just do what ever it is you wanted to do when the elements collide.

    Oh and if you are using a circular object you might want to us my circleCollide script. Explaination

  9. #9
    var x:Number = 1; x /= 0;
    Join Date
    Dec 2004
    Posts
    549
    ok

    thank you

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