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

Entity that is a quick way to make a particle. Has lots of parameters that can be set, so use this with that constructor where you do { } and put a bunch of properties inside. var p = new Particle(0, 0, "particle.png", 100, 100) { LifeSpan = 30, Angle = 10, FinalScaleX = 0, LockScaleRatio = true }; More...

Inherits Otter.Entity.

Public Member Functions

 Particle (float x, float y, string source=null, int width=0, int height=0)
 Create a new Particle. More...
 
 Particle (float x, float y, Texture texture, int width=0, int height=0)
 Create a new Particle. More...
 
 Particle (float x, float y, AtlasTexture texture, int width=0, int height=0)
 Create a new Particle. More...
 
 Particle (float x, float y)
 Create a blank Particle. More...
 
 Particle (float x, float y, ImageSet imageSet)
 Create a new Particle. More...
 
override void Added ()
 Added to the Scene. More...
 
void Start ()
 Start the Particle. More...
 
override void Update ()
 Update the Particle. More...
 
override void Removed ()
 Removed from the Scene. More...
 
override void SceneEnd ()
 Called when the Scene ends. More...
 
- Public Member Functions inherited from Otter.Entity
 Entity (float x=0, float y=0, Graphic graphic=null, Collider collider=null, string name="")
 Create an entity. More...
 
void SetGraphic (Graphic g)
 Sets the graphic to a new graphic, removing all previous graphics. More...
 
void SetPosition (float xy)
 Set the X and Y position to a value. More...
 
void AddPosition (float x, float y)
 Add to the X and Y positions of the Entity. More...
 
void AddPosition (Axis axis, float multiplier=1)
 Add to the X and Y position of the Entity. More...
 
void AddPosition (Vector2 vector)
 Add to the X and Y position of the Entity. More...
 
void SetPosition (float x, float y)
 Set the position of the Entity. More...
 
void SetPosition (Entity e, float offsetX=0, float offsetY=0)
 Set the position of the Entity to another Entity's position. More...
 
void SetPosition (Vector2 v)
 Set the position of the Entity. More...
 
AddGraphic< T > (T g)
 Adds a Graphic to the Entity. More...
 
AddGraphic< T > (T g, float x, float y)
 Adds a Graphic to the Entity. More...
 
List< GraphicAddGraphics (params Graphic[] graphics)
 Adds the graphics to the Entity. More...
 
AddGraphicGUI< T > (T g)
 Adds a graphic to the Entity and sets its Scroll value to 0. More...
 
AddGraphicGUI< T > (T g, float x, float y)
 Adds a graphic to the Entity and sets its Scroll value to 0. More...
 
List< GraphicAddGraphicsGUI (params Graphic[] graphics)
 Adds Graphics to the Entity and sets their Scroll values to 0. More...
 
RemoveGraphic< T > (T g)
 Removes a Graphic from the Entity. More...
 
void RemoveGraphics (params Graphic[] g)
 Removes Graphics from the Entity. More...
 
void ClearGraphics ()
 Remove all the graphics from the entity. More...
 
AddComponent< T > (T c)
 Adds a component to the entity. More...
 
AddComponent< T > (params object[] constructorArgs)
 Creates and adds a Component to the entity. More...
 
List< ComponentAddComponents (params Component[] c)
 Add multiple components to the entity. More...
 
RemoveComponent< T > (T c)
 Removes a component from the Entity. More...
 
RemoveComponent< T > ()
 Removes the first component of type T from the Entity. More...
 
void ClearComponents ()
 Remove all components from the Entity. More...
 
void AddSurface (Surface target)
 Add a surface that the entity should render to. More...
 
void RemoveSurface (Surface target)
 Remove a surface from the list of surfaces that the entity should render to. More...
 
void ClearSurfaces ()
 Remove all Surfaces from the list of Surfaces that the Entity should render to. More...
 
BoxCollider SetHitbox (int width, int height, params int[] tags)
 Shortcut to set the Collider of the entity to a BoxCollider. Using this will set the "Hitbox" field to this Collider. More...
 
BoxCollider SetHitbox (int width, int height, Enum tag, params Enum[] tags)
 Shortcut to set the Collider of the entity to a BoxCollider. Using this will set the "Hitbox" field to this Collider. More...
 
GetEntity< T > ()
 Get the first instance of an Entity of type T in this Entity's Scene. More...
 
List< T > GetEntities< T > ()
 Get a list of entities of type T from this Entity's Scene. More...
 
GetComponent< T > ()
 Get the first Component of type T. More...
 
Component GetComponent (Type type)
 Get the first Component of Type type. More...
 
List< T > GetComponents< T > ()
 Get all Components of type T. More...
 
GetGraphic< T > ()
 Get the first graphic of type T. More...
 
GetCollider< T > ()
 Get the first collider of type T. More...
 
AddCollider< T > (T c)
 Add a collider to the entity. More...
 
RemoveCollider< T > (T c)
 Remove the collider from the entity. More...
 
void ClearColliders ()
 Remove all colliders from the entity. More...
 
SetCollider< T > (T c)
 Remove all current colliders and set collider to a new one. More...
 
List< ColliderAddColliders (params Collider[] colliders)
 Adds colliders to the entity. More...
 
void RemoveColliders (params Collider[] colliders)
 Removes colliders from the entity. More...
 
Collider Collide (float x, float y, params int[] tags)
 Checks for a collision using the first available Collider. More...
 
Collider Collide (float x, float y, params Enum[] tags)
 Checks for a collision using the first available Collider. More...
 
List< ColliderCollideList (float x, float y, params int[] tags)
 Checks for a collision with the first available Collider. More...
 
List< ColliderCollideList (float x, float y, params Enum[] tags)
 Checks for a collision with the first available Collider. More...
 
List< EntityCollideEntities (float x, float y, params int[] tags)
 Checks for a collision with the first available Collider. More...
 
List< EntityCollideEntities (float x, float y, params Enum[] tags)
 Checks for a collision with the first available Collider. More...
 
List< T > CollideEntities< T > (float x, float y, List< T > entities)
 
List< T > CollideEntities< T > (float x, float y, params int[] tags)
 
List< T > CollideEntities< T > (float x, float y, params Enum[] tags)
 
bool Overlap (float x, float y, params int[] tags)
 Checks for an overlap using the first available collider. More...
 
bool Overlap (float x, float y, params Enum[] tags)
 Checks for an overlap using the first available collider. More...
 
bool Overlap (float x, float y, Entity e)
 Checks for an overlap using the first available collider. More...
 
virtual void SceneBegin ()
 Called when the Scene begins. More...
 
virtual void ScenePause ()
 Called when the Scene is paused. More...
 
virtual void SceneResume ()
 Called when the Scene is resumed. More...
 
virtual void Paused ()
 Called when the entity is paused by the Scene. More...
 
virtual void Resumed ()
 Called when the entity is resumed by the Scene. More...
 
Tween Tween (object target, object values, float duration, float delay=0)
 Tweens a set of numeric properties on an object. More...
 
virtual void UpdateFirst ()
 Called first during the update. Happens before Update. More...
 
virtual void UpdateLast ()
 Called last during the update. Happens after Update. More...
 
virtual void Render ()
 Called when the entity is rendering to the screen. More...
 
virtual void Prerender ()
 Called before an entity is rendered. Things rendered here will appear below the Entity's Graphics. More...
 
void RemoveSelf ()
 Remove this entity from the Scene it's in. More...
 

Public Attributes

Func< float, float > Ease
 The ease function to use when interpolating values. More...
 
ImageSet Image
 The ImageSet that the Particle is rendering. More...
 
float SpeedX
 The initial horizontal speed. More...
 
float SpeedY
 The initial vertical speed. More...
 
float OffsetX
 The horizontal offset from the spawn position. More...
 
float OffsetY
 The vertical offset from the spawn position. More...
 
float ScaleX = 1
 The initial X scale of the rendered Image. More...
 
float ScaleY = 1
 The initial Y scale fo the rendered Image. More...
 
float Angle
 The angle of the Image. More...
 
float Alpha = 1
 The initial alpha of the Image. More...
 
float ColorR = 1
 The initial Color R component of the Image. More...
 
float ColorG = 1
 The initial Color G component of the Image. More...
 
float ColorB = 1
 The initial Color B component of the Image. More...
 
float Delay
 The amount of time that must pass before the Entity is spawned. More...
 
int AdvanceSteps
 How many steps the particle should move by its speed when first created. More...
 
bool MotionAngle
 Determines if the image angle should be locked to the direction of the particle's movement. More...
 
BlendMode Blend = BlendMode.Alpha
 The BlendMode of the Image rendered. More...
 
int FrameOffset
 The starting frame in the ImageSet. More...
 
int Loops
 How many times to loop the ImageSet animation during the Particle's lifespan. More...
 
bool LockScaleRatio
 Determines if the ScaleY will always be locked to the ScaleX. More...
 
bool CenterOrigin = true
 Determines if the Image will have a centered origin. More...
 
bool FlipX = false
 Flip the ImageSet horizontally. More...
 
bool FlipY = false
 Flip the ImageSet vertically. More...
 
bool Animate
 Determines if the Particle should animate the ImageSet. More...
 
Shader Shader
 The shader to use on the ImageSet. More...
 
List< int > Frames
 The specific frames to display for the ImageSet. If set it will override the default FrameCount. More...
 
- Public Attributes inherited from Otter.Entity
float X
 The X position of the Entity. More...
 
float Y
 The Y position of the Entity. More...
 
float Timer
 How long the Entity has been active. More...
 
bool Visible = true
 Determines if the Entity will render. More...
 
bool Collidable = true
 Determines if the Entity will collide with other entities. The entity can still check for collisions, but will not register as a collision with other entities. More...
 
bool AutoUpdate = true
 Deteremines if the Entity's update functions will run automatically from the Scene. More...
 
bool AutoRender = true
 Determines if the Entity's render functions will run automatically from the Scene. More...
 
Tweener Tweener = new Tweener()
 The tween manager that controls all tweens on this entity. More...
 
Action OnAdded = delegate { }
 An action that fires when the entity is added to a Scene. More...
 
Action OnUpdate = delegate { }
 An action that fires when the entity is updated. More...
 
Action OnUpdateFirst = delegate { }
 An action that fires in the entity's UpdateFirst(). More...
 
Action OnUpdateLast = delegate { }
 An action that is fired in the entity's UpdateLast(). More...
 
Action OnRemoved = delegate { }
 An action that fires when the entity is removed from a Scene. More...
 
Action OnRender = delegate { }
 An action that fires when the entity is rendered. More...
 
string Name
 The name of this entity. Default's to the Type name. More...
 
int Layer
 The order in which to render this entity. Higher numbers draw later. More...
 
int Order
 The order in which to update this entity. Higher numbers update later. More...
 
int Group
 The pause group this entity is a part of. More...
 
float LifeSpan
 How long the entity should live in the scene before removing itself. If this is set the entity will be automatically removed when the Timer exceeds this value. More...
 

Static Public Attributes

static int ActiveCount = 0
 
static int DefaultLifeSpan = 60
 The default life span for all Particle Entities. More...
 

Properties

Color Color [get, set]
 The Color of the Particle. Overrides ColorR, ColorG, ColorB. More...
 
float SpeedLen [get, set]
 The magnitude of the particle's movement. Overrides SpeedX and SpeedY. More...
 
float SpeedDir [get, set]
 The direction of the particle's movement. Overrides SpeedX and SpeedY. More...
 
int FrameCount [get, set]
 How many frames are present in the ImageSet for the Particle to animate through. More...
 
float FinalSpeedX [get, set]
 The final horizontal speed of the Particle. More...
 
float FinalSpeedY [get, set]
 The final vertical speed of the Particle. More...
 
float FinalScaleX [get, set]
 The final X scale of the rendered Image. More...
 
float FinalScaleY [get, set]
 The final Y scale of the rendered Image. More...
 
float FinalAngle [get, set]
 The final angle of the rendered Image. More...
 
float FinalX [get, set]
 The final X position of the Particle. If set this overrides speed values. More...
 
float FinalY [get, set]
 The final Y position of the Particle. If set this overrides speed values. More...
 
float FinalAlpha [get, set]
 The final Alpha of the rendered Image. More...
 
float FinalColorR [get, set]
 The final Color R component of the rendered Image. More...
 
float FinalColorG [get, set]
 The final Color G component of the rendered Image. More...
 
float FinalColorB [get, set]
 The final Color B component of the rendered Image. More...
 
Color FinalColor [get, set]
 The final Color of the rendered Image. If set will override the R G B components. More...
 
float FinalSpeedLen [get, set]
 The final speed length of the Particle. If set will override SpeedX and SpeedY. More...
 
float FinalSpeedDir [get, set]
 The final speed direction of the Particle. If set will override SpeedX and SpeedY. More...
 
float OriginX [get, set]
 The X origin of the rendered Image. More...
 
float OriginY [get, set]
 The Y origin of the rendered Image. More...
 
- Properties inherited from Otter.Entity
bool UpdatedOnce [get, set]
 Is true if the Entity has been updated by the Scene at least once. More...
 
Component this[int id] [get]
 
List< GraphicGraphics [get, set]
 The list of graphics to render. More...
 
List< ComponentComponents [get, set]
 The list of components to update and render. More...
 
List< ColliderColliders [get, set]
 The list of colliders to use for collision checks. More...
 
List< SurfaceSurfaces [get, set]
 The list of surfaces the entity should draw to. More...
 
Scene Scene [get, set]
 The Scene that controls and updates this entity. More...
 
int InstanceId [get, set]
 The int id of the Entity for the Scene its currently in. More...
 
bool IsInScene [get]
 Returns true if the entity is currently in a Scene, or is queued to be added to a Scene next update. More...
 
Surface Surface [get, set]
 The default Surface that the entity should render to. More...
 
Entity Overlapped [get, set]
 The currently overlapped entity. This only works when using an Overlap collision check, and there is a result. More...
 
BoxCollider Hitbox [get, set]
 Set to a collider by using the SetHitbox method. Shortcut reference. More...
 
Collider Collider [get, set]
 Returns the first available collider, or set the Collider. More...
 
Input Input [get]
 A reference to the Input object in the Game that controls the Scene. More...
 
Game Game [get]
 A reference to the Game that controls the Scene. More...
 
bool IsPaused [get]
 If the entity is currently paused by the scene. More...
 
float ScreenX [get]
 The x position in screen space of the entity. More...
 
float ScreenY [get]
 The y position in screen space of the entity. More...
 
Graphic Graphic [get, set]
 Returns the first available graphic, or set the graphic. More...
 
Vector2 Position [get, set]
 The position of the Entity represented as a Vector2 More...
 

Detailed Description

Entity that is a quick way to make a particle. Has lots of parameters that can be set, so use this with that constructor where you do { } and put a bunch of properties inside. var p = new Particle(0, 0, "particle.png", 100, 100) { LifeSpan = 30, Angle = 10, FinalScaleX = 0, LockScaleRatio = true };

Constructor & Destructor Documentation

Otter.Particle.Particle ( float  x,
float  y,
string  source = null,
int  width = 0,
int  height = 0 
)

Create a new Particle.

Parameters
xThe x position.
yThe y position.
sourceThe source file path of the ImageSet.
widthThe width of the ImageSet cell.
heightThe height of the ImageSet cell.
Otter.Particle.Particle ( float  x,
float  y,
Texture  texture,
int  width = 0,
int  height = 0 
)

Create a new Particle.

Parameters
xThe x position.
yThe y position.
textureThe Texture to use for the ImageSet.
widthThe width of the ImageSet cell.
heightThe height of the ImageSet cell.
Otter.Particle.Particle ( float  x,
float  y,
AtlasTexture  texture,
int  width = 0,
int  height = 0 
)

Create a new Particle.

Parameters
xThe x position.
yThe y position.
texture
width
height
Otter.Particle.Particle ( float  x,
float  y 
)

Create a blank Particle.

Parameters
xThe x position.
yThe y position.
Otter.Particle.Particle ( float  x,
float  y,
ImageSet  imageSet 
)

Create a new Particle.

Parameters
xThe x position.
yThe y position.
ImageSetThe ImageSet to use for the Particle.

Member Function Documentation

override void Otter.Particle.Added ( )
virtual

Added to the Scene.

Reimplemented from Otter.Entity.

override void Otter.Particle.Removed ( )
virtual

Removed from the Scene.

Reimplemented from Otter.Entity.

override void Otter.Particle.SceneEnd ( )
virtual

Called when the Scene ends.

Reimplemented from Otter.Entity.

void Otter.Particle.Start ( )

Start the Particle.

override void Otter.Particle.Update ( )
virtual

Update the Particle.

Reimplemented from Otter.Entity.

Member Data Documentation

int Otter.Particle.AdvanceSteps

How many steps the particle should move by its speed when first created.

float Otter.Particle.Alpha = 1

The initial alpha of the Image.

float Otter.Particle.Angle

The angle of the Image.

bool Otter.Particle.Animate

Determines if the Particle should animate the ImageSet.

BlendMode Otter.Particle.Blend = BlendMode.Alpha

The BlendMode of the Image rendered.

bool Otter.Particle.CenterOrigin = true

Determines if the Image will have a centered origin.

float Otter.Particle.ColorB = 1

The initial Color B component of the Image.

float Otter.Particle.ColorG = 1

The initial Color G component of the Image.

float Otter.Particle.ColorR = 1

The initial Color R component of the Image.

int Otter.Particle.DefaultLifeSpan = 60
static

The default life span for all Particle Entities.

float Otter.Particle.Delay

The amount of time that must pass before the Entity is spawned.

Func<float, float> Otter.Particle.Ease

The ease function to use when interpolating values.

bool Otter.Particle.FlipX = false

Flip the ImageSet horizontally.

bool Otter.Particle.FlipY = false

Flip the ImageSet vertically.

int Otter.Particle.FrameOffset

The starting frame in the ImageSet.

List<int> Otter.Particle.Frames

The specific frames to display for the ImageSet. If set it will override the default FrameCount.

ImageSet Otter.Particle.Image

The ImageSet that the Particle is rendering.

bool Otter.Particle.LockScaleRatio

Determines if the ScaleY will always be locked to the ScaleX.

int Otter.Particle.Loops

How many times to loop the ImageSet animation during the Particle's lifespan.

bool Otter.Particle.MotionAngle

Determines if the image angle should be locked to the direction of the particle's movement.

float Otter.Particle.OffsetX

The horizontal offset from the spawn position.

float Otter.Particle.OffsetY

The vertical offset from the spawn position.

float Otter.Particle.ScaleX = 1

The initial X scale of the rendered Image.

float Otter.Particle.ScaleY = 1

The initial Y scale fo the rendered Image.

Shader Otter.Particle.Shader

The shader to use on the ImageSet.

float Otter.Particle.SpeedX

The initial horizontal speed.

float Otter.Particle.SpeedY

The initial vertical speed.

Property Documentation

Color Otter.Particle.Color
getset

The Color of the Particle. Overrides ColorR, ColorG, ColorB.

float Otter.Particle.FinalAlpha
getset

The final Alpha of the rendered Image.

float Otter.Particle.FinalAngle
getset

The final angle of the rendered Image.

Color Otter.Particle.FinalColor
getset

The final Color of the rendered Image. If set will override the R G B components.

float Otter.Particle.FinalColorB
getset

The final Color B component of the rendered Image.

float Otter.Particle.FinalColorG
getset

The final Color G component of the rendered Image.

float Otter.Particle.FinalColorR
getset

The final Color R component of the rendered Image.

float Otter.Particle.FinalScaleX
getset

The final X scale of the rendered Image.

float Otter.Particle.FinalScaleY
getset

The final Y scale of the rendered Image.

float Otter.Particle.FinalSpeedDir
getset

The final speed direction of the Particle. If set will override SpeedX and SpeedY.

float Otter.Particle.FinalSpeedLen
getset

The final speed length of the Particle. If set will override SpeedX and SpeedY.

float Otter.Particle.FinalSpeedX
getset

The final horizontal speed of the Particle.

float Otter.Particle.FinalSpeedY
getset

The final vertical speed of the Particle.

float Otter.Particle.FinalX
getset

The final X position of the Particle. If set this overrides speed values.

float Otter.Particle.FinalY
getset

The final Y position of the Particle. If set this overrides speed values.

int Otter.Particle.FrameCount
getset

How many frames are present in the ImageSet for the Particle to animate through.

float Otter.Particle.OriginX
getset

The X origin of the rendered Image.

float Otter.Particle.OriginY
getset

The Y origin of the rendered Image.

float Otter.Particle.SpeedDir
getset

The direction of the particle's movement. Overrides SpeedX and SpeedY.

float Otter.Particle.SpeedLen
getset

The magnitude of the particle's movement. Overrides SpeedX and SpeedY.


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