Packageorg.flintparticles.twoD.zones
Interfacepublic interface Zone2D
Implementors BitmapDataZone, DiscSectorZone, DiscZone, DisplayObjectZone, GreyscaleZone, LineZone, MultiZone, PointZone, RectangleZone

The Zones interface must be implemented by all zones.

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.



Public Methods
 MethodDefined 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
Method Detail
collideParticle()method
public function collideParticle(particle:Particle2D, bounce:Number = 1):Boolean

Manages 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.

Returns
Boolean — Whether a collision occured.
contains()method 
public function contains(x:Number, y:Number):Boolean

Determines 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.

Returns
Boolean — true if point is inside the zone, false if it is outside.
getArea()method 
public function getArea():Number

Returns the size of the zone. This method is used by the MultiZone class to manage the balancing between the different zones.

Returns
Number — the size of the zone.
getLocation()method 
public function getLocation():Point

Returns 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.

Returns
Point — a random point inside the zone.