| Package | com.whirled.contrib.display |
| Class | public class PhysicalBase |
| Inheritance | PhysicalBase flash.display.MovieClip |
Important! The convention for coordinates in Flash is that an increase in the y direction indicates movement in a downward direction. To apply an acceleration that forces objects downwards use a positive acceleration, not a negative acceleration.
This class is meant to be extended.
Author: jdnx429| Property | Defined by | ||
|---|---|---|---|
| accelX : Number = 0 The x component of the object's acceleration in pixels/second/second.
| PhysicalBase | ||
| accelY : Number = 0
The y component of the object's acceleration in pixels/second/second.
| PhysicalBase | ||
| drag : Number = 0.0
The drag constant of the object.
| PhysicalBase | ||
| dragLimit : Number = 1000
The minimum speed at which drag occurs in pixels/second.
| PhysicalBase | ||
| physicalTimer : Timer
The timer that controls object updating.
| PhysicalBase | ||
| speedX : Number = 0 The x component of the object's speed in pixels/second.
| PhysicalBase | ||
| speedY : Number = 0
The y component of the object's speed in pixels/second.
| PhysicalBase | ||
| Method | Defined by | ||
|---|---|---|---|
|
PhysicalBase(xpos:Number, ypos:Number)
Creates a PhysicalBase object at the location specfied.
| PhysicalBase | ||
|
addAccVector(acc:Number, angle:Number):void
Check this, watch speed and accel.
| PhysicalBase | ||
|
addSpeedVector(speed:Number, angle:Number):void
Adds the current speed vector with the supplied vector.
| PhysicalBase | ||
|
destroy():void
Destroys the object.
| PhysicalBase | ||
|
getAngle():Number
Returns the current direction of the object.
| PhysicalBase | ||
|
getSpeed():Number
Returns the current speed of the object in pixels per second.
| PhysicalBase | ||
|
halt():void
Sets all speed and acceleration to 0, stopping the object.
| PhysicalBase | ||
|
setAccComp(xacc:Number, yacc:Number):void
Sets the acceleration of the object using x and y components.
| PhysicalBase | ||
|
setAccVector(acc:Number, angle:Number):void
Sets the acceleration of the object using a vector.
| PhysicalBase | ||
|
setDrag(dragnum:Number, dragLimitnum:Number):void
Sets the drag and the drag limit of the object.
| PhysicalBase | ||
|
setLocation(xpos:Number, ypos:Number):void
Sets the location of the object.
| PhysicalBase | ||
|
setSpeedComp(xnum:Number, ynum:Number):void
Sets the speed of the object using the x and y components.
| PhysicalBase | ||
|
setSpeedVector(speed:Number, angle:Number):void
Sets the speed of the object using the speed of the object and an angle.
| PhysicalBase | ||
|
startMoving():void
Initializes the Timer that controls the object and starts moving the object in accordance
with its properties.
| PhysicalBase | ||
| Method | Defined by | ||
|---|---|---|---|
|
applyDrag():void
| PhysicalBase | ||
| accelX | property |
public var accelX:Number = 0The x component of the object's acceleration in pixels/second/second.
| accelY | property |
public var accelY:Number = 0The y component of the object's acceleration in pixels/second/second. A positive number indicates a downward direction.
| drag | property |
public var drag:Number = 0.0The drag constant of the object. The range is typically 0.0 to 5.0. The ultimate decceleration force is a combination of the drag constant and the speed of the object.
| dragLimit | property |
public var dragLimit:Number = 1000The minimum speed at which drag occurs in pixels/second. While the object is below this speed no drag is applied. At speeds above the dragLimit, drag progressively increases with speed.
| physicalTimer | property |
public var physicalTimer:TimerThe timer that controls object updating. This is set to 33.333 milliseconds which translates to 30 frames per second. Changing the delay of the timer won't change the speed of the objects, only how often the objects are rendered.
| speedX | property |
public var speedX:Number = 0The x component of the object's speed in pixels/second.
| speedY | property |
public var speedY:Number = 0The y component of the object's speed in pixels/second. A positive number indicates a downward direction.
| PhysicalBase | () | constructor |
public function PhysicalBase(xpos:Number, ypos:Number)Creates a PhysicalBase object at the location specfied.
Parametersxpos:Number — - the x-coordinate of the object.
|
|
ypos:Number — - the y-coordinate of the object.
|
| addAccVector | () | method |
public function addAccVector(acc:Number, angle:Number):voidCheck this, watch speed and accel.
Parametersacc:Number |
|
angle:Number |
| addSpeedVector | () | method |
public function addSpeedVector(speed:Number, angle:Number):voidAdds the current speed vector with the supplied vector.
Parametersspeed:Number — the speed of the speed vector to be added to the object.
|
|
angle:Number — the angle of the speed vector to be added to the object. This is set in
degrees.
|
| applyDrag | () | method |
protected function applyDrag():void
| destroy | () | method |
public function destroy():voidDestroys the object. Removes the EventListener to the Timer that controls the object and removes it from the Stage or parent Movie Clip
| getAngle | () | method |
public function getAngle():NumberReturns the current direction of the object.
ReturnsNumber — the angle in degrees that the object is moving in.
|
| getSpeed | () | method |
public function getSpeed():NumberReturns the current speed of the object in pixels per second.
ReturnsNumber — the speed of the object.
|
| halt | () | method |
public function halt():voidSets all speed and acceleration to 0, stopping the object.
| setAccComp | () | method |
public function setAccComp(xacc:Number, yacc:Number):voidSets the acceleration of the object using x and y components.
Parametersxacc:Number — the x component of the acceleration.
|
|
yacc:Number — the y component of the acceleration.
|
| setAccVector | () | method |
public function setAccVector(acc:Number, angle:Number):voidSets the acceleration of the object using a vector.
Parametersacc:Number — the acceleration of the object.
|
|
angle:Number — the angle of the applied acceleration in degrees. Y-coordinates are positive
in the downward direction. An angle of 90 degrees is therefore straight down.
|
| setDrag | () | method |
public function setDrag(dragnum:Number, dragLimitnum:Number):voidSets the drag and the drag limit of the object.
Parametersdragnum:Number — the drag of the object.
|
|
dragLimitnum:Number — the dragLimit of the object.
|
| setLocation | () | method |
public function setLocation(xpos:Number, ypos:Number):voidSets the location of the object.
Parametersxpos:Number — the x-coordinate of the object.
|
|
ypos:Number — the y-coordinate of the object.
|
| setSpeedComp | () | method |
public function setSpeedComp(xnum:Number, ynum:Number):voidSets the speed of the object using the x and y components.
Parametersxnum:Number — the x component of the speed.
|
|
ynum:Number — the y component of the speed.
|
| setSpeedVector | () | method |
public function setSpeedVector(speed:Number, angle:Number):voidSets the speed of the object using the speed of the object and an angle.
Parametersspeed:Number — the speed of the object
|
|
angle:Number — the angle of the object - this is set in degrees. Remember that y is positive
the downward direction. An angle of 90 degrees therefore is straight down.
|
| startMoving | () | method |
public function startMoving():voidInitializes the Timer that controls the object and starts moving the object in accordance with its properties.