Otter
0.9.8.91
2d Game Development Framework based on SFML.Net
|
Movement Component that adds platforming movement behavior to an Entity. This is built for fixed framerate applications. Make sure you have the Axis, JumpButton, and Collider assigned before using it! If you want to use jump through platforms, you'll also need to use the JumpThroughCollider, which should be a 1 pixel tall collider at the bottom of your Entity. More...
Inherits Otter.Movement.
Public Member Functions | |
PlatformingMovement (float xSpeedMax, float ySpeedMax, float gravity) | |
Create a new PlatformingMovement. More... | |
void | AddJumpThrough (params int[] tags) |
Register a collision tag to treat as jump through platforms. More... | |
void | AddJumpThrough (params Enum[] tags) |
Register a collision tag to treat as jump through platforms. More... | |
override void | Update () |
Updates the movement. More... | |
override void | MoveCollideX (Collider collider) |
Called when MoveX collides with a collider. More... | |
override void | MoveCollideY (Collider collider) |
Called when MoveY collides with a collider. More... | |
override void | MoveY (int speed, Collider collider=null) |
Move the object in the Y axis by the value of speed. Sweeping collision test. More... | |
Public Member Functions inherited from Otter.Movement | |
void | AddCollision (params int[] tags) |
Register a tag that the Collider should check for collisions with. More... | |
void | AddCollision (params Enum[] tags) |
Register a tag that the Collider should check for collisions with. More... | |
void | RemoveCollision (params int[] tags) |
Remove a tag from the collision checking. More... | |
virtual void | MoveX (int speed, Collider collider=null) |
Move the object in the X axis by the value of speed. Sweeping collision test. More... | |
void | MoveXY (int speedX, int speedY, Collider collider=null) |
Shortcut to call both move x and move y. More... | |
Public Member Functions inherited from Otter.Component | |
T | GetEntity< T > () |
Get the Entity as a specific Type. More... | |
virtual void | Added () |
Called when the Component is added to the Entity. More... | |
virtual void | Removed () |
Called when the Component is removed from the Entity. More... | |
void | RemoveSelf () |
Removes the Component from its parent Entity. More... | |
virtual void | UpdateFirst () |
Called during the UpdateFirst on the parent Entity. More... | |
virtual void | Render () |
Called during the Render on the parent Entity. More... | |
virtual void | UpdateLast () |
Called during the UpdateLast on the parent Entity. More... | |
T | GetComponent< T > () |
Gets the first Component of type T from this Component's Entity. More... | |
List< T > | GetComponents< T > () |
Gets a list of Components of type T from this Component's Entity. More... | |
Public Attributes | |
Speed | Speed |
The main input speed of the platforming movement. More... | |
Speed | ExtraSpeed |
Any extra speed applied (from boosts, dashes, springs, conveyors, etc) More... | |
Speed | TargetSpeed |
The target speed that the input speed will approach (used for Axis input) More... | |
float | Gravity |
The acceleration applied from gravity. More... | |
float | GravityMultiplier = 1 |
The multiplication factor on the applied gravity. More... | |
float | JumpStrength = 1500 |
The burst of speed applied when jumping. More... | |
bool | OnGround = true |
If the object is currently on the ground (Y+1 overlaps the ground.) More... | |
int | JumpsLeft = 0 |
How many jumps are left to use. More... | |
int | JumpsMax = 1 |
The maximum number of jumps each time the object touches the ground. More... | |
int | JumpBufferMax = 4 |
The maximum amount of frames to buffer jump input for the next available moment to jump. More... | |
int | LedgeBufferMax = 4 |
The maximum number of frames to allow the object to jump after leaving the ground. More... | |
bool | JumpEnabled = true |
Determines if the object is capable of jumping. More... | |
bool | HardDoubleJump = true |
Determines if a double jump should add jump strength to the current jump, or set the Y speed to the jump speed. For example, if true then an object traveling downward will jump up at full jump strength, if false it will jump at it's downward speed minus jump strenght. More... | |
float | JumpDampening = 0.75f |
How much to dampen the Y speed when the object releases the jump button in the air. More... | |
bool | HasJumped = false |
If the object is in the air because it jumped (instead of falling off a ledge, etc) More... | |
bool | VariableJumpHeight = true |
Determines if the object can control its jump height by releasing jump while in the air. More... | |
bool | UseAxis = true |
Determines if the movement should listen to the Axis for input. More... | |
bool | ApplyGravity = true |
Determines if the movement should have gravity applied to it. More... | |
Button | JumpButton |
The Button used for the jumping input. More... | |
Axis | Axis |
The axis used for movement input. More... | |
Action | OnJump |
An action that is triggered on a successful jump. More... | |
Collider | JumpThroughCollider |
Dictionary< AccelType, int > | Acceleration = new Dictionary<AccelType, int>() |
The dictionary of acceleration values. More... | |
bool | DownJumpDrop = true |
Determines if holding Down while pushing Jump will cause the Entity to drop through jump through platforms instead of jumping. More... | |
Public Attributes inherited from Otter.Movement | |
Action | OnMove |
An action triggered after movement as been applied. Up to subclasses to implement. More... | |
int | SpeedScale = 100 |
Determines how many units represent 1 pixel. Default is 100. Example: A speed of 100 would move the object 1 pixel per update. More... | |
new Collider | Collider |
The main Collider to use for detecting collisions. If this is not set, no collisions will register at all! More... | |
Action | OnCollideX |
An action triggered when there is a collision in the X axis. More... | |
Action | OnCollideY |
An action triggered when there is a collision in the Y axis. More... | |
Public Attributes inherited from Otter.Component | |
Entity | Entity |
The parent Entity of the Component. More... | |
bool | RenderAfterEntity = true |
Determines if the Component should render after the Entity has rendered. More... | |
bool | Visible = true |
Determines if the Component will render. More... | |
float | Timer = 0 |
How long the Component has been alive (added to an Entity and updated.) More... | |
Static Public Attributes | |
static int | DefaultAccleration = 150 |
The default acceleration value to use if none are set. More... | |
Properties | |
int | CurrentAccel [get, set] |
The current acceleration value. More... | |
bool | AgainstWallLeft [get, set] |
If the Collider is currently against a wall on the left. More... | |
bool | AgainstWallRight [get, set] |
If the Collider is currently against a wall on the right. More... | |
bool | AgainstCeiling [get, set] |
If the Collider is currently against a ceiling above it. More... | |
bool | JustJumped [get, set] |
True for one update after the object has jumped. More... | |
List< int > | CollisionsJumpThrough [get, set] |
The list of tags to treat as jump through platforms. More... | |
float | SumSpeedX [get] |
The total X speed. More... | |
float | SumSpeedY [get] |
The total Y speed. More... | |
Properties inherited from Otter.Movement | |
List< int > | CollisionsSolid [get, set] |
The list of types that the Collider should check for collisions for when moving. More... | |
Properties inherited from Otter.Component | |
int | InstanceId [get, set] |
The Component's id for the Entity its attached to. More... | |
Scene | Scene [get] |
The Scene that the parent Entity is in. More... | |
Collider | Collider [get] |
The first Collider of the parent Entity. More... | |
Graphic | Graphic [get] |
The first Graphic of the parent Entity. More... | |
List< Graphic > | Graphics [get] |
The list of Graphics from the parent Entity. More... | |
List< Collider > | Colliders [get] |
The list of Colliders from the parent Entity. More... | |
Additional Inherited Members | |
Protected Attributes inherited from Otter.Movement | |
int | MoveBufferX = 0 |
Movement Component that adds platforming movement behavior to an Entity. This is built for fixed framerate applications. Make sure you have the Axis, JumpButton, and Collider assigned before using it! If you want to use jump through platforms, you'll also need to use the JumpThroughCollider, which should be a 1 pixel tall collider at the bottom of your Entity.
Otter.PlatformingMovement.PlatformingMovement | ( | float | xSpeedMax, |
float | ySpeedMax, | ||
float | gravity | ||
) |
Create a new PlatformingMovement.
xSpeedMax | The maximum X input speed. |
ySpeedMax | The maximum Y speed from jumping and gravity. |
gravity | The acceleration caused by gravity. |
void Otter.PlatformingMovement.AddJumpThrough | ( | params int[] | tags | ) |
Register a collision tag to treat as jump through platforms.
tags | Tags to register. |
void Otter.PlatformingMovement.AddJumpThrough | ( | params Enum[] | tags | ) |
Register a collision tag to treat as jump through platforms.
tags | Tags to register. |
|
virtual |
Called when MoveX collides with a collider.
collider | The collider that was hit. |
Reimplemented from Otter.Movement.
|
virtual |
Called when MoveY collides with a collider.
collider | The collider that was hit. |
Reimplemented from Otter.Movement.
|
virtual |
Move the object in the Y axis by the value of speed. Sweeping collision test.
speed | The speed to move by (remember SpeedScale is applied.) |
collider | The Collider to use when moving. |
Reimplemented from Otter.Movement.
|
virtual |
Updates the movement.
Reimplemented from Otter.Component.
Dictionary<AccelType, int> Otter.PlatformingMovement.Acceleration = new Dictionary<AccelType, int>() |
The dictionary of acceleration values.
bool Otter.PlatformingMovement.ApplyGravity = true |
Determines if the movement should have gravity applied to it.
Axis Otter.PlatformingMovement.Axis |
The axis used for movement input.
|
static |
The default acceleration value to use if none are set.
bool Otter.PlatformingMovement.DownJumpDrop = true |
Determines if holding Down while pushing Jump will cause the Entity to drop through jump through platforms instead of jumping.
Speed Otter.PlatformingMovement.ExtraSpeed |
Any extra speed applied (from boosts, dashes, springs, conveyors, etc)
float Otter.PlatformingMovement.Gravity |
The acceleration applied from gravity.
float Otter.PlatformingMovement.GravityMultiplier = 1 |
The multiplication factor on the applied gravity.
bool Otter.PlatformingMovement.HardDoubleJump = true |
Determines if a double jump should add jump strength to the current jump, or set the Y speed to the jump speed. For example, if true then an object traveling downward will jump up at full jump strength, if false it will jump at it's downward speed minus jump strenght.
bool Otter.PlatformingMovement.HasJumped = false |
If the object is in the air because it jumped (instead of falling off a ledge, etc)
int Otter.PlatformingMovement.JumpBufferMax = 4 |
The maximum amount of frames to buffer jump input for the next available moment to jump.
float Otter.PlatformingMovement.JumpDampening = 0.75f |
How much to dampen the Y speed when the object releases the jump button in the air.
bool Otter.PlatformingMovement.JumpEnabled = true |
Determines if the object is capable of jumping.
int Otter.PlatformingMovement.JumpsLeft = 0 |
How many jumps are left to use.
int Otter.PlatformingMovement.JumpsMax = 1 |
The maximum number of jumps each time the object touches the ground.
float Otter.PlatformingMovement.JumpStrength = 1500 |
The burst of speed applied when jumping.
int Otter.PlatformingMovement.LedgeBufferMax = 4 |
The maximum number of frames to allow the object to jump after leaving the ground.
bool Otter.PlatformingMovement.OnGround = true |
If the object is currently on the ground (Y+1 overlaps the ground.)
Action Otter.PlatformingMovement.OnJump |
An action that is triggered on a successful jump.
Speed Otter.PlatformingMovement.Speed |
The main input speed of the platforming movement.
Speed Otter.PlatformingMovement.TargetSpeed |
The target speed that the input speed will approach (used for Axis input)
bool Otter.PlatformingMovement.UseAxis = true |
Determines if the movement should listen to the Axis for input.
bool Otter.PlatformingMovement.VariableJumpHeight = true |
Determines if the object can control its jump height by releasing jump while in the air.
|
getset |
If the Collider is currently against a ceiling above it.
|
getset |
If the Collider is currently against a wall on the left.
|
getset |
If the Collider is currently against a wall on the right.
|
getset |
The list of tags to treat as jump through platforms.
|
getset |
The current acceleration value.
|
getset |
True for one update after the object has jumped.
|
get |
The total X speed.
|
get |
The total Y speed.