C# Класс 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).
Наследование: Sprite
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
moveAngleHelper ( float angle, float speed, float elapsed, bool collide = true ) : bool
moveDirectionHelper ( Direction dir, float speed, float elapsed, bool collide = true ) : bool

Описание методов

FreeMovingSprite() публичный Метод

public FreeMovingSprite ( ) : System
Результат System

FreeMovingSprite() публичный Метод

public FreeMovingSprite ( int x, int y ) : System
x int
y int
Результат System

FreeMovingSprite() публичный Метод

public FreeMovingSprite ( int x, int y, float speed, float accel ) : System
x int
y int
speed float
accel float
Результат System

FreeMovingSprite() публичный Метод

public FreeMovingSprite ( int x, int y, int width, int height ) : System
x int
y int
width int
height int
Результат System

FreeMovingSprite() публичный Метод

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
Результат System

cancelMoveToDestination() публичный Метод

public cancelMoveToDestination ( ) : void
Результат void

getAcceleration() публичный Метод

public getAcceleration ( ) : float
Результат float

getSpeed() публичный Метод

public getSpeed ( ) : float
Результат float

move() публичный Метод

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
Результат bool

move() публичный Метод

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
Результат bool

moveToDestination() публичный Метод

public moveToDestination ( int x, int y, System.Action postExecute, bool collide = false ) : void
x int
y int
postExecute System.Action
collide bool
Результат void

moveToDestination() публичный Метод

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
Результат void

reset() публичный Метод

public reset ( ) : void
Результат void

setAcceleration() публичный Метод

public setAcceleration ( float accel ) : void
accel float
Результат void

setSpeed() публичный Метод

public setSpeed ( float speed ) : void
speed float
Результат void

update() публичный Метод

public update ( float elapsed ) : void
elapsed float
Результат void