LuaDocs/MOSprite
From Data Realms Wiki
Contents |
Parent: MovableObject
Abstract Class. A movable object with mass that is graphically represented by a BITMAP.
Enumerations
SpriteAnimMode
- 0 = NOANIM
- 1 = ALWAYSLOOP
- 2 = ALWAYSRANDOM
- 3 = ALWAYSPINGPONG
- 4 = LOOPWHENMOVING
- 5 = LOOPWHENOPENCLOSE
- 6 = PINGPONGOPENCLOSE
Properties
ClassName
The class name of this Entity.A string with the friendly-formatted type name of this object.
Diameter
Read-only property. The largest diameter of this in pixels.The largest diameter across its graphical representation.
BoundingBox
Read-only property. The oriented bounding box which is guaranteed to contain this, taking rotation etc into account. It's not guaranteed to be fit perfectly though. TODO: MAKE FIT BETTERA Box which is guaranteed to contain this. Does nto take wrapping into account, and parts of this box may be out of bounds!
FrameCount
Read-only property. The number of frames in this MOSprite's animation.The frame count.
SpriteOffset
The offset that the BITMAP has from the position of this MOSprite.A vector with the offset.
HFlipped
Returns whether this MOSprite is being drawn flipped horizontally (along the vertical axis), or not.Whether flipped or not.
RotAngle
The current rotational angle of of this, in radians.The rotational angle of this, in radians.
AngularVel
The current angular velocity of this MovableObject. Positive is a counter-clockwise rotation.The angular velocity in radians per second.
Frame
Tells which frame is currently set to show.An unsigned int describing the current frame.
SpriteAnimMode
The animation mode.The animation mode currently in effect.
Functions
SetNextFrame
Hard-sets the frame this sprite is supposed to show, to the consecutive one after the current one. If currently the last fame is this will set it to the be the first, looping the animation.
Arguments:
- None.
Return value:
Whether the animation looped or not with this setting.
IsTooFast
Indicates whether this MO is moving or rotating stupidly fast in a way that will screw up the simulation.
Arguments:
- None.
Return value:
Whetehr this is eitehr moving or rotating too fast.
IsOnScenePoint
Indicates whether this' current graphical representation overlaps a point in absolute scene coordinates.
Arguments:
- The point in absolute scene coordinates.
Return value:
Whether this' graphical rep overlaps the scene point.
RotateOffset
Takes a vector which is offset from the center of this when not rotated or flipped, and then rotates and/or flips it to transform it into this' 'local space', if applicable.
Arguments:
- A vector which is supposed to be offset from this' center when upright.
Return value:
The resulting vector whihch has been flipped and rotated as appropriate.
UnRotateOffset
Takes a vector which is offset from the center of this when not rotated or flipped, and then rotates and/or flips it to transform it into this' 'local space', but in REVERSE.
Arguments:
- A vector which is supposed to be offset from this' center when upright.
Return value:
The resulting vector whihch has been flipped and rotated as appropriate.