Otter  0.9.8.91
2d Game Development Framework based on SFML.Net
 All Classes Namespaces Functions Variables Enumerations Properties
Otter.Movement Class Reference

A base class for Movement Components to extend. More...

Inherits Otter.Component.

Inherited by Otter.BasicMovement, and Otter.PlatformingMovement.

Public Member Functions

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...
 
virtual void MoveY (int speed, Collider collider=null)
 Move the object in the Y axis by the value of speed. Sweeping collision test. More...
 
virtual void MoveCollideX (Collider collider)
 Called when MoveX collides with a collider. More...
 
virtual void MoveCollideY (Collider collider)
 Called when MoveY collides with a collider. 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
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 Update ()
 Called during the Update 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...
 
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

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...
 

Protected Attributes

int MoveBufferX = 0
 

Properties

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< GraphicGraphics [get]
 The list of Graphics from the parent Entity. More...
 
List< ColliderColliders [get]
 The list of Colliders from the parent Entity. More...
 

Detailed Description

A base class for Movement Components to extend.

Member Function Documentation

void Otter.Movement.AddCollision ( params int[]  tags)

Register a tag that the Collider should check for collisions with.

Parameters
tagsThe tags to collide with.
void Otter.Movement.AddCollision ( params Enum[]  tags)

Register a tag that the Collider should check for collisions with.

Parameters
tagsThe tags to collide with.
virtual void Otter.Movement.MoveCollideX ( Collider  collider)
virtual

Called when MoveX collides with a collider.

Parameters
colliderThe collider that was hit.

Reimplemented in Otter.PlatformingMovement, and Otter.BasicMovement.

virtual void Otter.Movement.MoveCollideY ( Collider  collider)
virtual

Called when MoveY collides with a collider.

Parameters
colliderThe collider that was hit.

Reimplemented in Otter.PlatformingMovement, and Otter.BasicMovement.

virtual void Otter.Movement.MoveX ( int  speed,
Collider  collider = null 
)
virtual

Move the object in the X axis by the value of speed. Sweeping collision test.

Parameters
speedThe speed to move by (remember SpeedScale is applied.)
colliderThe Collider to use when moving.
void Otter.Movement.MoveXY ( int  speedX,
int  speedY,
Collider  collider = null 
)

Shortcut to call both move x and move y.

Parameters
speedX
speedY
collider
virtual void Otter.Movement.MoveY ( int  speed,
Collider  collider = null 
)
virtual

Move the object in the Y axis by the value of speed. Sweeping collision test.

Parameters
speedThe speed to move by (remember SpeedScale is applied.)
colliderThe Collider to use when moving.

Reimplemented in Otter.PlatformingMovement.

void Otter.Movement.RemoveCollision ( params int[]  tags)

Remove a tag from the collision checking.

Parameters
tags

Member Data Documentation

new Collider Otter.Movement.Collider

The main Collider to use for detecting collisions. If this is not set, no collisions will register at all!

Action Otter.Movement.OnCollideX

An action triggered when there is a collision in the X axis.

Action Otter.Movement.OnCollideY

An action triggered when there is a collision in the Y axis.

Action Otter.Movement.OnMove

An action triggered after movement as been applied. Up to subclasses to implement.

int Otter.Movement.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.

Property Documentation

List<int> Otter.Movement.CollisionsSolid
getset

The list of types that the Collider should check for collisions for when moving.


The documentation for this class was generated from the following file: