C# Class SunsetHigh.FreeMovingSprite

A child of Sprite that has the ability to move around the scene through preprogrammed directions or through user control. Can move with speed and acceleration independent of framerate - the units for these quantities are pixels/sec and pixels/(sec^2).
Inheritance: Sprite
Mostrar archivo Open project: ErraticUnicorn/MOSH Class Usage Examples

Public Methods

Method Description
FreeMovingSprite ( ) : System
FreeMovingSprite ( int x, int y ) : System
FreeMovingSprite ( int x, int y, float speed, float accel ) : System
FreeMovingSprite ( int x, int y, int width, int height ) : System
FreeMovingSprite ( int x, int y, int width, int height, float speed, float accel ) : System
cancelMoveToDestination ( ) : void
getAcceleration ( ) : float
getSpeed ( ) : float
move ( Direction dir, float elapsed, bool collide = true ) : bool

Moves this Sprite a given Direction. Optional parameter sets it to collide with the scene and characters in the scene.

move ( float angle, float elapsed, bool collide = true ) : bool

Moves this Sprite a given angle (0 to 2 pi). Optional parameter sets it to collide with the scene and characters in the scene.

moveToDestination ( int x, int y, System.Action postExecute, bool collide = false ) : void
moveToDestination ( int x, int y, float time, System.Action postExecute, bool collide = false ) : void
reset ( ) : void
setAcceleration ( float accel ) : void
setSpeed ( float speed ) : void
update ( float elapsed ) : void

Private Methods

Method Description
moveAngleHelper ( float angle, float speed, float elapsed, bool collide = true ) : bool
moveDirectionHelper ( Direction dir, float speed, float elapsed, bool collide = true ) : bool

Method Details

FreeMovingSprite() public method

public FreeMovingSprite ( ) : System
return System

FreeMovingSprite() public method

public FreeMovingSprite ( int x, int y ) : System
x int
y int
return System

FreeMovingSprite() public method

public FreeMovingSprite ( int x, int y, float speed, float accel ) : System
x int
y int
speed float
accel float
return System

FreeMovingSprite() public method

public FreeMovingSprite ( int x, int y, int width, int height ) : System
x int
y int
width int
height int
return System

FreeMovingSprite() public method

public FreeMovingSprite ( int x, int y, int width, int height, float speed, float accel ) : System
x int
y int
width int
height int
speed float
accel float
return System

cancelMoveToDestination() public method

public cancelMoveToDestination ( ) : void
return void

getAcceleration() public method

public getAcceleration ( ) : float
return float

getSpeed() public method

public getSpeed ( ) : float
return float

move() public method

Moves this Sprite a given Direction. Optional parameter sets it to collide with the scene and characters in the scene.
public move ( Direction dir, float elapsed, bool collide = true ) : bool
dir Direction Direction to move the Character
elapsed float Time that has elapsed since last update, in seconds
collide bool Specifies whether the Sprite should collide with objects in the scene
return bool

move() public method

Moves this Sprite a given angle (0 to 2 pi). Optional parameter sets it to collide with the scene and characters in the scene.
public move ( float angle, float elapsed, bool collide = true ) : bool
angle float Angle in radians, from 0 to 2 pi, to move the Character
elapsed float Time that has elapsed since last update, in seconds
collide bool Specifies whether the Sprite should collide with objects in the scene
return bool

moveToDestination() public method

public moveToDestination ( int x, int y, System.Action postExecute, bool collide = false ) : void
x int
y int
postExecute System.Action
collide bool
return void

moveToDestination() public method

public moveToDestination ( int x, int y, float time, System.Action postExecute, bool collide = false ) : void
x int
y int
time float
postExecute System.Action
collide bool
return void

reset() public method

public reset ( ) : void
return void

setAcceleration() public method

public setAcceleration ( float accel ) : void
accel float
return void

setSpeed() public method

public setSpeed ( float speed ) : void
speed float
return void

update() public method

public update ( float elapsed ) : void
elapsed float
return void