C# Class ScrollingShooter.PlayerShip

A base class for all Player ships
Inheritance: ScrollingShooter.GameObject
Afficher le fichier Open project: zombiepaladin/scrolling-shooter Class Usage Examples

Méthodes publiques

Свойство Type Description
Dead bool
DeathTimer float
Health float
HomingMissileLevel short
InvincibleFrame float
InvincibleTimer float
Kills int
Lives int
MaxHealth float
Score int
defaultGunTimer float
energyBlastLevel int
energyBlastTimer float

Protected Properties

Свойство Type Description
position Vector2
railgunSpriteBounds Microsoft.Xna.Framework.Rectangle
spriteBounds Microsoft.Xna.Framework.Rectangle[]
spriteSheet Microsoft.Xna.Framework.Graphics.Texture2D
velocity Vector2

Méthodes publiques

Méthode Description
ApplyPowerup ( PowerupType powerup ) : void

Applies the specified powerup to the ship

ClearPowerups ( ) : void
Draw ( float elaspedTime, SpriteBatch spriteBatch ) : void

Draw the ship on-screen

EndLevel ( float elaspedTime ) : void
GetPosition ( ) : Vector2
MoveShip ( Vector2 direction ) : void
PlayerShip ( uint id, Microsoft.Xna.Framework.Content.ContentManager content ) : System

Creates a new Player ship instance and initializes sound effects

ScrollWithMap ( float elapsedTime ) : void

Scrolls the object with the map

Update ( float elapsedTime ) : void

Updates the ship

Private Methods

Méthode Description
ApplyBlades ( ) : void

A helper function that initializes the blades powerup. //Puts a giant spinning blade over player position and doubles the players velocity.

ApplyTriShield ( ) : void

A helper function that initializes the tri-shield. Creates three trishield balls.

GetDrunk ( ) : void

Makes the player drunk. If the player is already drunk the player is just made drunk for longer. The drunk counter is increased by a random number. Time to be drunk is between 5 and 10 seconds.

SoberUp ( ) : void

Makes the player sober. Activated when the drunk time has run out.

TriggerBirdcrap ( ) : void

A helper that fires birdcrap from the ship. Coraspondes to the birdcrap power up.

TriggerBomb ( ) : void
TriggerDroneWave ( ) : void

A helper function that fires a wide drone wave from the ship, corresponding to the fireball powerup.

TriggerEightBallShield ( ) : void

Helper function to create an eightballshield around the ship

TriggerEnergyBlast ( ) : void

A helper function that fires an energy blast from the ship, corresponding to the energy blast powerup

TriggerFireball ( ) : void

A helper function that fires a fireball from the ship, corresponding to the fireball powerup

TriggerFrostball ( ) : void

A helper function that fires a frostball from the ship, corresponding to the frostball powerup

TriggerHomingMissile ( ) : void

Handles the firing of a homing missile

TriggerMeteor ( ) : void

A helper function that starts a meteor storm, corresponding to the meteor powerup

TriggerRailgun ( ) : void

Fires the railgun sabot round from the ship, corresponding to the railgun powerup

TriggerShotgun ( ) : void

A helper function that shoots a spray shot from the ship when the spray shot powerup is active

unApplyBlades ( ) : void

A helper function that will remove the Blade powerup and restore defaults.

Method Details

ApplyPowerup() public méthode

Applies the specified powerup to the ship
public ApplyPowerup ( PowerupType powerup ) : void
powerup PowerupType the indicated powerup
Résultat void

ClearPowerups() public méthode

public ClearPowerups ( ) : void
Résultat void

Draw() public méthode

Draw the ship on-screen
public Draw ( float elaspedTime, SpriteBatch spriteBatch ) : void
elaspedTime float The elapsed time
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch An already-initialized spritebatch, ready for Draw() commands
Résultat void

EndLevel() public méthode

public EndLevel ( float elaspedTime ) : void
elaspedTime float
Résultat void

GetPosition() public méthode

public GetPosition ( ) : Vector2
Résultat Vector2

MoveShip() public méthode

public MoveShip ( Vector2 direction ) : void
direction Vector2
Résultat void

PlayerShip() public méthode

Creates a new Player ship instance and initializes sound effects
public PlayerShip ( uint id, Microsoft.Xna.Framework.Content.ContentManager content ) : System
id uint the unique id of the Player ship
content Microsoft.Xna.Framework.Content.ContentManager
Résultat System

ScrollWithMap() public méthode

Scrolls the object with the map
public ScrollWithMap ( float elapsedTime ) : void
elapsedTime float The in-game time between the previous and current frame
Résultat void

Update() public méthode

Updates the ship
public Update ( float elapsedTime ) : void
elapsedTime float
Résultat void

Property Details

Dead public_oe property

Player's alive-ness
public bool Dead
Résultat bool

DeathTimer public_oe property

Player's death timer
public float DeathTimer
Résultat float

Health public_oe property

Player's Health
public float Health
Résultat float

HomingMissileLevel public_oe static_oe property

public static short HomingMissileLevel
Résultat short

InvincibleFrame public_oe property

Player's invincible frame
public float InvincibleFrame
Résultat float

InvincibleTimer public_oe property

Player's invincible timer
public float InvincibleTimer
Résultat float

Kills public_oe property

Player's Kill count
public int Kills
Résultat int

Lives public_oe property

Player's Lives
public int Lives
Résultat int

MaxHealth public_oe property

Player's Max Health
public float MaxHealth
Résultat float

Score public_oe property

Player's Score
public int Score
Résultat int

defaultGunTimer public_oe property

Timer for the default gun
public float defaultGunTimer
Résultat float

energyBlastLevel public_oe property

Level of the energy blast powerup
public int energyBlastLevel
Résultat int

energyBlastTimer public_oe property

Timer for the energy blast gun
public float energyBlastTimer
Résultat float

position protected_oe property

The position of the ship in the game world. We use a Vector2 for position rather than a Rectangle, as floats allow us to move less than a pixel
protected Vector2 position
Résultat Vector2

railgunSpriteBounds protected_oe property

Rectangle to draw the railgun when the powerup is enabled
protected Rectangle,Microsoft.Xna.Framework railgunSpriteBounds
Résultat Microsoft.Xna.Framework.Rectangle

spriteBounds protected_oe property

The spritebounds for our ship, corresponding to the five possible steering states
protected Rectangle[],Microsoft.Xna.Framework spriteBounds
Résultat Microsoft.Xna.Framework.Rectangle[]

spriteSheet protected_oe property

The spritesheet our ship is found upon
protected Texture2D,Microsoft.Xna.Framework.Graphics spriteSheet
Résultat Microsoft.Xna.Framework.Graphics.Texture2D

velocity protected_oe property

The velocity of the ship - varies from ship to ship
protected Vector2 velocity
Résultat Vector2