| Package | org.flintparticles.twoD.zones |
| Interface | public interface Zone2D |
| Implementors | BitmapDataZone, DiscSectorZone, DiscZone, DisplayObjectZone, GreyscaleZone, LineZone, MultiZone, PointZone, RectangleZone |
A zone is a class that defined a region in 2d space. The two required methods make it easy to get a random point within the zone and to find whether a specific point is within the zone. Zones are used to define the start location for particles (in the Position initializer), to define the start velocity for particles (in the Velocity initializer), and to define zones within which the particles die.
| Method | Defined By | ||
|---|---|---|---|
collideParticle(particle:Particle2D, bounce:Number = 1):Boolean
Manages collisions between a particle and the zone. | Zone2D | ||
contains(x:Number, y:Number):Boolean
Determines whether a point is inside the zone. | Zone2D | ||
getArea():Number
Returns the size of the zone. | Zone2D | ||
getLocation():Point
Returns a random point inside the zone. | Zone2D | ||
| collideParticle | () | method |
public function collideParticle(particle:Particle2D, bounce:Number = 1):BooleanManages collisions between a particle and the zone. This method handles altering the particle's position and velocity in response to the collision.
Parameters
particle:Particle2D — The particle to be tested for collision with the zone.
| |
bounce:Number (default = 1) — The coefficient of restitution for the collision.
|
Boolean — Whether a collision occured.
|
| contains | () | method |
public function contains(x:Number, y:Number):BooleanDetermines whether a point is inside the zone. This method is used by the initializers and actions that use the zone. Usually, it need not be called directly by the user.
Parameters
x:Number — The x coordinate of the location to test for.
| |
y:Number — The y coordinate of the location to test for.
|
Boolean — true if point is inside the zone, false if it is outside.
|
| getArea | () | method |
public function getArea():NumberReturns the size of the zone. This method is used by the MultiZone class to manage the balancing between the different zones.
ReturnsNumber — the size of the zone.
|
| getLocation | () | method |
public function getLocation():PointReturns a random point inside the zone. This method is used by the initializers and actions that use the zone. Usually, it need not be called directly by the user.
ReturnsPoint — a random point inside the zone.
|