Package | org.cove.ape |
Class | public class RectangleParticle |
Inheritance | RectangleParticle ![]() ![]() |
Property | Defined by | ||
---|---|---|---|
![]() | alwaysRepaint : Boolean
For performance, fixed Particles and SpringConstraints don't have their
paint()
method called in order to avoid unnecessary redrawing. | AbstractItem | |
angle : Number
The rotation of the RectangleParticle in degrees.
| RectangleParticle | ||
![]() | center : Vector
Returns A Vector of the current location of the particle
| AbstractParticle | |
![]() | collidable : Boolean
Determines if the particle can collide with other particles or constraints.
| AbstractParticle | |
![]() | elasticity : Number
The elasticity of the particle.
| AbstractParticle | |
![]() | fixed : Boolean
The fixed state of the particle.
| AbstractParticle | |
![]() | friction : Number
The surface friction of the particle.
| AbstractParticle | |
height : Number | RectangleParticle | ||
![]() | mass : Number
The mass of the particle.
| AbstractParticle | |
![]() | multisample : int
Determines the number of intermediate position steps checked for collision each
cycle.
| AbstractParticle | |
![]() | position : Vector
The position of the particle.
| AbstractParticle | |
![]() | px : Number
The x position of this particle
| AbstractParticle | |
![]() | py : Number
The y position of this particle
| AbstractParticle | |
radian : Number
The rotation of the RectangleParticle in radians.
| RectangleParticle | ||
![]() | sprite : Sprite
Provides a Sprite to use as a container for drawing or adding children.
| AbstractItem | |
![]() | velocity : Vector
The velocity of the particle.
| AbstractParticle | |
![]() | visible : Boolean
The visibility of the item.
| AbstractItem | |
width : Number | RectangleParticle |
Method | Defined by | ||
---|---|---|---|
RectangleParticle(x:Number, y:Number, width:Number, height:Number, rotation:Number = 0, fixed:Boolean = false, mass:Number = 1, elasticity:Number = 0.3, friction:Number = 0)
| RectangleParticle | ||
![]() |
Adds a force to the particle.
| AbstractParticle | |
![]() |
addMasslessForce(f:Vector):void
Adds a 'massless' force to the particle.
| AbstractParticle | |
![]() |
cleanup():void
This method is called automatically when an item's parent group is removed
from the APEngine.
| AbstractItem | |
init():void
Sets up the visual representation of this RectangleParticle.
| RectangleParticle | ||
paint():void
The default painting method for this particle.
| RectangleParticle | ||
![]() |
setDisplay(d:DisplayObject, offsetX:Number = 0, offsetY:Number = 0, rotation:Number = 0):void
Assigns a DisplayObject to be used when painting this particle.
| AbstractParticle | |
![]() |
setFill(color:uint = 0xffffff, alpha:Number = 1):void
Sets the style of the fill for this Item.
| AbstractItem | |
![]() |
setLine(thickness:Number = 0, color:uint = 0x000000, alpha:Number = 1):void
Sets the style of the line for this Item.
| AbstractItem | |
![]() |
setStyle(lineThickness:Number = 0, lineColor:uint = 0x000000, lineAlpha:Number = 1, fillColor:uint = 0xffffff, fillAlpha:Number = 1):void
Sets the line and fill of this Item.
| AbstractItem | |
![]() |
update(dt2:Number):void
The
update() method is called automatically during the
APEngine.step() cycle. | AbstractParticle |
angle | property |
angle:Number
[read-write]The rotation of the RectangleParticle in degrees.
Implementation public function get angle():Number
public function set angle(value:Number):void
height | property |
height:Number
[read-write]Implementation
public function get height():Number
public function set height(value:Number):void
radian | property |
radian:Number
[read-write]
The rotation of the RectangleParticle in radians. For drawing methods you may
want to use the angle
property which gives the rotation in
degrees from 0 to 360.
Note that while the RectangleParticle can be rotated, it does not have angular velocity. In otherwords, during collisions, the rotation is not altered, and the energy of the rotation is not applied to other colliding particles.
Implementation public function get radian():Number
public function set radian(value:Number):void
width | property |
width:Number
[read-write]Implementation
public function get width():Number
public function set width(value:Number):void
RectangleParticle | () | constructor |
public function RectangleParticle(x:Number, y:Number, width:Number, height:Number, rotation:Number = 0, fixed:Boolean = false, mass:Number = 1, elasticity:Number = 0.3, friction:Number = 0)
Parameters
x:Number — The initial x position.
|
|
y:Number — The initial y position.
|
|
width:Number — The width of this particle.
|
|
height:Number — The height of this particle.
|
|
rotation:Number (default = 0 ) — The rotation of this particle in radians.
|
|
fixed:Boolean (default = false ) — Determines if the particle is fixed or not. Fixed particles
are not affected by forces or collisions and are good to use as surfaces.
Non-fixed particles move freely in response to collision and forces.
|
|
mass:Number (default = 1 ) — The mass of the particle
|
|
elasticity:Number (default = 0.3 ) — The elasticity of the particle. Higher values mean more elasticity.
|
|
friction:Number (default = 0 ) — The surface friction of the particle.
Note that RectangleParticles can be fixed but still have their rotation property changed. |
init | () | method |
public override function init():void
Sets up the visual representation of this RectangleParticle. This method is called automatically when an instance of this RectangleParticle's parent Group is added to the APEngine, when this RectangleParticle's Composite is added to a Group, or the RectangleParticle is added to a Composite or Group.
paint | () | method |
public override function paint():void
The default painting method for this particle. This method is called automatically
by the APEngine.paint()
method. If you want to define your own custom painting
method, then create a subclass of this class and override paint()
.