Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: FLASH: URGENT: Still working on collision
From: George Gleissner
Date: Thu, 2 Nov 2000 17:10:47 GMT

Howdy,
I'm still trying to make this collision thing happen. I am working in Flash
5 and using the HitTest
method. However, I am confused on how to reference my objects.

Here's the basic setup:
Two boats travel across the screen in the background. Standing on the dock
the player has to throw
crabs into the back of the boats(using a square for the hit area).

The crabs are set up like this:
Crab: instance name crab(movie clip:onstage)
>Crab (motion clip:library)

Then there are two instances of the boat movie clip: leftboat and rightboat
(these move via ActionScript)
Leftboat (instance)
>Boat (movieclip)
>Boattarget(movie clip on boat timeline/instance name: tbox)

So basically, do I refernce the instances or the symbols themselves? And
where do I put the code;
in the main timeline, the symbols, or the instances?

Thanks,
George Gleissner
Web Production Specialist
Association of Legal Administrators
847.247.5572
ggleissneratalanet [dot] org






-----Original Message-----
From: Gregg Caines [gcatneometrixsystems [dot] com (mailto:gcatneometrixsystems [dot] com)]
Sent: Monday, October 30, 2000 3:47 PM
To: flasheratchinwag [dot] com
Subject: Re: FLASH: ActionScript Help


Well collision detection requires that you know the coordinates
of each point on the entire perimeter of the object. The easiest
method is to make the perimeters for the objects simple squares
and create some algorithm to check if the two squares overlap.
You'll need to use width, height, x, and y properties and you'll
need to check for collision with each of the four corners.
The corners for a movie clip will be at these coordinates:
(x,y)
(x+width,y)
(x,y+height)
(x+width,y+height)

For example, you'll know if a given corner of MC1 is inside MC2
if both of its coordinates are greater than or equal to the coordinates
of MC2's upper left corner and less than or equal to the coordinates
of MC2's lower right corner. You'll need to test all 4 corners too...

Also, if the movie clips are different sizes, make sure you're testing
the corners of the smaller one.

Hopefully that makes a little sense...

---------------------------------------------------
Gregg Caines
n e o m e t r i x systems inc.
http://www.neometrixsystems.com
gcainesatneometrixsystems [dot] com


> I tried that and it did work, however I am having trouble associating that
> set of variables with the set from another object to determine collision.
>
> The second object is also a motion clip which moves across the screen via
> ActionScript.
>
> So, basically I can get the coordinates for both objects, I just don't
know
> how to make them
> talk to each other.
>
> Thanks,
> George Gleissner
> Web Production Specialist
> Association of Legal Administrators
> 847.247.5572
> ggleissneratalanet [dot] org



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flasher is generously supported by...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flashforward2000 and the Flash(tm) Film Festival
November 27-29, 2000, LONDON, National Film Theatre

Produced by United Digital Artists and lynda.com
-Sponsored by Macromedia, Adobe Systems and Apple Computer
-http://www.flashforward2000.com or UK tel. +44 (0870) 751 1526
Register before November 10 and save £200
http:// www.flashforward2000.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe or change your list settings go to
http://www.chinwag.com/flasher or email helpatchinwag [dot] com

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flasher is generously supported by...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flashforward2000 and the Flash(tm) Film Festival
November 27-29, 2000, LONDON, National Film Theatre

Produced by United Digital Artists and lynda.com
-Sponsored by Macromedia, Adobe Systems and Apple Computer
-http://www.flashforward2000.com or UK tel. +44 (0870) 751 1526
Register before November 10 and save £200
http:// www.flashforward2000.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe or change your list settings go to
http://www.chinwag.com/flasher or email helpatchinwag [dot] com


Replies
  Re: FLASH: URGENT: Still working on coll, Gregg Caines

[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]