C# 클래스 ThreadedPlatformer.Player

Our fearless adventurer!
파일 보기 프로젝트 열기: sq/Fracture 1 사용 예제들

공개 메소드들

메소드 설명
ApplyPhysics ( GameTime gameTime ) : void

Updates the player's velocity and position based on input, gravity, etc.

Draw ( GameTime gameTime, BitmapBatch batch ) : void

Draws the animated player.

LoadContent ( ) : void

Loads the player sprite sheet and sounds.

OnKilled ( Enemy killedBy ) : void

Called when the player has been killed.

OnReachedExit ( ) : void

Called when this player reaches the level's exit.

Player ( Level level, Vector2 position ) : System

Constructors a new player.

Reset ( Vector2 position ) : void

Resets the player to life.

Update ( GameTime gameTime ) : void

Handles input, performs physics, and animates the player sprite.

비공개 메소드들

메소드 설명
DoJump ( float velocityY, GameTime gameTime ) : float

Calculates the Y velocity accounting for jumping and animates accordingly.

During the accent of a jump, the Y velocity is completely overridden by a power curve. During the decent, gravity takes over. The jump velocity is controlled by the jumpTime field which measures time into the accent of the current jump.

GetInput ( ) : void

Gets player horizontal movement and jump commands from input.

HandleCollisions ( ) : void

Detects and resolves all collisions between the player and his neighboring tiles. When a collision is detected, the player is pushed away along one axis to prevent overlapping. There is some special logic for the Y axis to handle platforms which behave differently depending on direction of movement.

메소드 상세

ApplyPhysics() 공개 메소드

Updates the player's velocity and position based on input, gravity, etc.
public ApplyPhysics ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
리턴 void

Draw() 공개 메소드

Draws the animated player.
public Draw ( GameTime gameTime, BitmapBatch batch ) : void
gameTime Microsoft.Xna.Framework.GameTime
batch BitmapBatch
리턴 void

LoadContent() 공개 메소드

Loads the player sprite sheet and sounds.
public LoadContent ( ) : void
리턴 void

OnKilled() 공개 메소드

Called when the player has been killed.
public OnKilled ( Enemy killedBy ) : void
killedBy Enemy /// The enemy who killed the player. This parameter is null if the player was /// not killed by an enemy (fell into a hole). ///
리턴 void

OnReachedExit() 공개 메소드

Called when this player reaches the level's exit.
public OnReachedExit ( ) : void
리턴 void

Player() 공개 메소드

Constructors a new player.
public Player ( Level level, Vector2 position ) : System
level Level
position Vector2
리턴 System

Reset() 공개 메소드

Resets the player to life.
public Reset ( Vector2 position ) : void
position Vector2 The position to come to life at.
리턴 void

Update() 공개 메소드

Handles input, performs physics, and animates the player sprite.
public Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
리턴 void