FlixelPositional
View sourceinterface
org.flixelgdx.functional.FlixelPositional
Spatial and kinematic surface shared by FlixelObject: world position, size, scroll factors, velocity-based motion, and immovable toggling so motion tweens never need to cast to FlixelObject.
See Also: FlixelObject
Methods
getScrollX()
Parallax scroll factor on X (1 means the object moves with the camera like a normal world object).
Returns: Current scroll X factor.
getScrollY()
Parallax scroll factor on Y (1 means the object moves with the camera like a normal world object).
Returns: Current scroll Y factor.
setScrollFactor(float, float)
Sets FlixelPositional.getScrollX() and FlixelPositional.getScrollY().
Parameters:
| Name | Description |
|---|---|
scrollX | Horizontal scroll factor. |
scrollY | Vertical scroll factor. |
getX()
X position of the upper left corner of this object in world space.
Returns: Current X in world units.
setX(float)
Sets world X.
Parameters:
| Name | Description |
|---|---|
x | New X position. |
getY()
Y position of the upper left corner of this object in world space.
Returns: Current Y in world units.
setY(float)
Sets world Y.
Parameters:
| Name | Description |
|---|---|
y | New Y position. |
getWidth()
Width of this object's hitbox.
Returns: Hitbox width.
setWidth(float)
Sets hitbox width.
Parameters:
| Name | Description |
|---|---|
width | New width. |
getHeight()
Height of this object's hitbox.
Returns: Hitbox height.
setHeight(float)
Sets hitbox height.
Parameters:
| Name | Description |
|---|---|
height | New height. |
getLastX()
X position at the start of the current frame, before motion.
Returns: Last frame's starting X.
getLastY()
Y position at the start of the current frame, before motion.
Returns: Last frame's starting Y.
setPosition(float, float)
Helper that sets both world coordinates.
Parameters:
| Name | Description |
|---|---|
x | The new X position. |
y | The new Y position. |
setSize(float, float)
Shortcut for setting both FlixelPositional.getWidth() and FlixelPositional.getHeight().
Parameters:
| Name | Description |
|---|---|
width | The new width. |
height | The new height. |
changeX(float)
Adds dx to the current X position.
changeY(float)
Adds dy to the current Y position.
getMidpointX()
Returns the center X coordinate of this object.
getMidpointY()
Returns the center Y coordinate of this object.
getVelocityX()
Horizontal velocity in pixels per second.
setVelocityX(float)
Sets horizontal velocity in pixels per second.
getVelocityY()
Vertical velocity in pixels per second.
setVelocityY(float)
Sets vertical velocity in pixels per second.
setVelocity(float, float)
Sets both velocity components.
Parameters:
| Name | Description |
|---|---|
vx | Horizontal velocity. |
vy | Vertical velocity. |
getAccelerationX()
Horizontal acceleration in pixels per second squared.
setAccelerationX(float)
Sets horizontal acceleration in pixels per second squared.
getAccelerationY()
Vertical acceleration in pixels per second squared.
setAccelerationY(float)
Sets vertical acceleration in pixels per second squared.
setAcceleration(float, float)
Sets both acceleration components.
Parameters:
| Name | Description |
|---|---|
ax | Horizontal acceleration. |
ay | Vertical acceleration. |
getDragX()
Deceleration applied when FlixelPositional.getAccelerationX() is zero. Only applied when greater than 0.
Returns: Horizontal drag.
setDragX(float)
Sets horizontal drag.
getDragY()
Deceleration applied when FlixelPositional.getAccelerationY() is zero. Only applied when greater than 0.
Returns: Vertical drag.
setDragY(float)
Sets vertical drag.
setDrag(float, float)
Sets both drag components.
Parameters:
| Name | Description |
|---|---|
dx | Horizontal drag. |
dy | Vertical drag. |
getMaxVelocityX()
Maximum absolute horizontal velocity.
setMaxVelocityX(float)
Sets maximum absolute horizontal velocity.
getMaxVelocityY()
Maximum absolute vertical velocity.
setMaxVelocityY(float)
Sets maximum absolute vertical velocity.
setMaxVelocity(float, float)
Sets both max velocity components.
Parameters:
| Name | Description |
|---|---|
mvx | Maximum horizontal speed. |
mvy | Maximum vertical speed. |
getAngularVelocity()
Rotational speed in degrees per second.
setAngularVelocity(float)
Sets rotational speed in degrees per second.
getAngularAcceleration()
Rotational acceleration in degrees per second squared.
setAngularAcceleration(float)
Sets rotational acceleration in degrees per second squared.
getAngularDrag()
Rotational drag in degrees per second squared.
setAngularDrag(float)
Sets rotational drag in degrees per second squared.
getMaxAngularVelocity()
Maximum angular velocity in degrees per second.
setMaxAngularVelocity(float)
Sets maximum angular velocity in degrees per second.
getMoves()
When true, FlixelObject.updateMotion(float) runs each frame on FlixelObject.
Returns: Whether integrated motion is enabled.
setMoves(boolean)
Enables or disables automatic motion integration on FlixelObject.
Parameters:
| Name | Description |
|---|---|
moves | true to integrate velocity each frame. |
isImmovable()
When true, this object will not be moved by collision resolution. Other objects will still be pushed away from it.
Returns: Current immovable flag.
setImmovable(boolean)
Sets whether collision resolution may move this object.
Parameters:
| Name | Description |
|---|---|
immovable | true to freeze this object during separation. |