C# Class geek.GameEngine.Visuals.GameObject

The class that describes all active objects in the game that move, animate and interact with the user.
Inheritance: InteractableObject
Mostra file Open project: impworks/xna.geek.engine Class Usage Examples

Public Properties

Property Type Description
CollisionDetectionMode CollisionDetectionMode
IsBlendingEnabled bool

Public Methods

Method Description
AddAnimation ( string assetName, int frameCount, float frameRate, bool looped = true ) : AnimatedSprite

Create a new animation for the object.

AddAnimation ( string assetName ) : Sprite

Creates a new static animation frame for the object.

Draw ( SpriteBatch batch ) : void

Draws the current animation frame to screen.

GameObject ( ) : System
GameObject ( Vector2 position ) : System
GameObject ( float x, float y ) : System
GetBoundingBox ( bool absolute = false ) : Rectangle

Returns the bounding box for the object. The current sprite is used. The bounding box does not take transparency into account.

GetCurrentAnimation ( ) : SpriteBase

Returns the current animation that is played.

IsOverlappedWith ( InteractableObject obj ) : bool

Smart collision detection allowing for pixel-perfect collisions.

SetAnimation ( SpriteBase sprite ) : void

Set the current animation and play it.

SetAnimation ( int id, bool restart = false ) : void

Set the current animation and play it.

Update ( ) : void

Update the current animation.

Method Details

AddAnimation() public method

Create a new animation for the object.
public AddAnimation ( string assetName, int frameCount, float frameRate, bool looped = true ) : AnimatedSprite
assetName string Asset name to use as texture.
frameCount int Number of frames in the animation.
frameRate float Frame rate.
looped bool Loop animation flag.
return geek.GameEngine.Sprites.AnimatedSprite

AddAnimation() public method

Creates a new static animation frame for the object.
public AddAnimation ( string assetName ) : Sprite
assetName string Asset name to use.
return Sprite

Draw() public method

Draws the current animation frame to screen.
public Draw ( SpriteBatch batch ) : void
batch Microsoft.Xna.Framework.Graphics.SpriteBatch Sprite batch
return void

GameObject() public method

public GameObject ( ) : System
return System

GameObject() public method

public GameObject ( Vector2 position ) : System
position Vector2
return System

GameObject() public method

public GameObject ( float x, float y ) : System
x float
y float
return System

GetBoundingBox() public method

Returns the bounding box for the object. The current sprite is used. The bounding box does not take transparency into account.
public GetBoundingBox ( bool absolute = false ) : Rectangle
absolute bool
return Microsoft.Xna.Framework.Rectangle

GetCurrentAnimation() public method

Returns the current animation that is played.
public GetCurrentAnimation ( ) : SpriteBase
return geek.GameEngine.Sprites.SpriteBase

IsOverlappedWith() public method

Smart collision detection allowing for pixel-perfect collisions.
public IsOverlappedWith ( InteractableObject obj ) : bool
obj InteractableObject Object to test against
return bool

SetAnimation() public method

Set the current animation and play it.
public SetAnimation ( SpriteBase sprite ) : void
sprite geek.GameEngine.Sprites.SpriteBase Animation.
return void

SetAnimation() public method

Set the current animation and play it.
public SetAnimation ( int id, bool restart = false ) : void
id int Animation id.
restart bool
return void

Update() public method

Update the current animation.
public Update ( ) : void
return void

Property Details

CollisionDetectionMode public_oe property

The collision detection mode.
public CollisionDetectionMode CollisionDetectionMode
return CollisionDetectionMode

IsBlendingEnabled public_oe property

Activate blendable animations' blending mode?
public bool IsBlendingEnabled
return bool