dynapi.fx.MotionX - Quick Reference
Remarks
MotionX is an extension to the DynLayer API which is used to make a layer appears to be solid, and will trigger the oncollide() event whenever collisions occurs
Constructor
[none]
Events
- oncollide(e)
- ...
- onmove(e)
- ...
Public Methods
- makeSolid()
- Making a layer solid does not prevent other layers from passing through it. It simple means that the layer will receive an event whenever it comes in contact with another solid layer. This also enables the layer to tell the direction in which it is moving. MotionX was design mainly for creating games with dynapi.
- getImpactSide()
- (string) Returns the impacted side of the layer. Example: N, S, E or W
- getObstacle()
- returns the colliding DynLayer
- getDirection()
- (string) Returns the direction in which the layer is moving. Example N, S, E, W, etc.
When the getDirection() method is called a string data-type is returned which can be used to tell the direction in which the layer is moving. The following are some possible directions returned by the getDirection() method:
- N
- North
- S
- South
- E
- East
- W
- West
- NE
- North East
- NW
- North West
- SE
- South East
- SW
- South West
- getDirectionAngle()
- (int) Returns the angle in which the layer is moving. This functions provides a more accurate way of knowing the direction in which the layer is moving can be done by calling the getDirectionAngle() method. This method returns an angle ranging from 0 to 259. (Should this be 359?)
Private Methods
[none]
Static Methods
[none]