C# Class ScrollingShooter.PlayerShip

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

Public Properties

Property 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

Property Type Description
position Vector2
railgunSpriteBounds Microsoft.Xna.Framework.Rectangle
spriteBounds Microsoft.Xna.Framework.Rectangle[]
spriteSheet Microsoft.Xna.Framework.Graphics.Texture2D
velocity Vector2

Public Methods

Method 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

Method 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 method

Applies the specified powerup to the ship
public ApplyPowerup ( PowerupType powerup ) : void
powerup PowerupType the indicated powerup
return void

ClearPowerups() public method

public ClearPowerups ( ) : void
return void

Draw() public method

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
return void

EndLevel() public method

public EndLevel ( float elaspedTime ) : void
elaspedTime float
return void

GetPosition() public method

public GetPosition ( ) : Vector2
return Vector2

MoveShip() public method

public MoveShip ( Vector2 direction ) : void
direction Vector2
return void

PlayerShip() public method

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
return System

ScrollWithMap() public method

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

Update() public method

Updates the ship
public Update ( float elapsedTime ) : void
elapsedTime float
return void

Property Details

Dead public_oe property

Player's alive-ness
public bool Dead
return bool

DeathTimer public_oe property

Player's death timer
public float DeathTimer
return float

Health public_oe property

Player's Health
public float Health
return float

HomingMissileLevel public_oe static_oe property

public static short HomingMissileLevel
return short

InvincibleFrame public_oe property

Player's invincible frame
public float InvincibleFrame
return float

InvincibleTimer public_oe property

Player's invincible timer
public float InvincibleTimer
return float

Kills public_oe property

Player's Kill count
public int Kills
return int

Lives public_oe property

Player's Lives
public int Lives
return int

MaxHealth public_oe property

Player's Max Health
public float MaxHealth
return float

Score public_oe property

Player's Score
public int Score
return int

defaultGunTimer public_oe property

Timer for the default gun
public float defaultGunTimer
return float

energyBlastLevel public_oe property

Level of the energy blast powerup
public int energyBlastLevel
return int

energyBlastTimer public_oe property

Timer for the energy blast gun
public float energyBlastTimer
return 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
return Vector2

railgunSpriteBounds protected_oe property

Rectangle to draw the railgun when the powerup is enabled
protected Rectangle,Microsoft.Xna.Framework railgunSpriteBounds
return 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
return Microsoft.Xna.Framework.Rectangle[]

spriteSheet protected_oe property

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

velocity protected_oe property

The velocity of the ship - varies from ship to ship
protected Vector2 velocity
return Vector2