Arcade Shooter
Public Member Functions | Protected Member Functions | List of all members
ShooterLibrary::Ship Class Referenceabstract

Base class for all ships. More...

#include <Ship.h>

Inheritance diagram for ShooterLibrary::Ship:
ShooterLibrary::GameObject ShooterLibrary::EnemyShip ShooterLibrary::PlayerShip Sample::BioEnemyShip Sample::PlayerShip

Public Member Functions

virtual void Update (const GameTime *pGameTime)
 Updates the game object. More...
 
virtual void Draw (SpriteBatch *pSpriteBatch)=0
 Called when the game determines it is time to draw a frame. More...
 
virtual void Hit (const float damage)
 Hits the ship, dealing damage to it. More...
 
virtual bool IsInvulnurable () const
 Determines if the ship takes damage. More...
 
virtual void SetInvulnurable (bool isInvulnurable=true)
 Sets whether or not the ship takes damage. More...
 
virtual std::string ToString () const
 Gets a string representation of the ship. More...
 
virtual CollisionType GetCollisionType () const =0
 Gets the collision type mask. More...
 
virtual void AttachWeapon (Weapon *pWeapon, Vector2 position)
 Attaches a weapon to the ship. More...
 
- Public Member Functions inherited from ShooterLibrary::GameObject
virtual void SetDeactivateCallback (OnDeactivate callback)
 Sets the callback function for when the menu item is selected. More...
 
virtual void Update (const GameTime *pGameTime)
 Updates the game object. More...
 
virtual void Draw (SpriteBatch *pSpriteBatch)=0
 Renders the game object. More...
 
virtual bool IsActive () const
 Determines if the game object is active. More...
 
virtual void Activate ()
 Activates the game object.
 
virtual void Deactivate ()
 Deactivates the game object.
 
virtual Vector2GetPosition ()
 Gets the position of the game object. More...
 
virtual Vector2GetPreviousPosition ()
 Gets the previous position of the game object. More...
 
virtual Vector2 GetHalfDimensions () const
 Gets the half dimensions of the game object. More...
 
virtual uint32_t GetIndex () const
 Gets the index of the game object. More...
 
virtual float GetCollisionRadius () const
 Gets the collision radius. More...
 
virtual bool HasMask (CollisionType mask) const
 Determines if the object contains part of a collision bit-mask. More...
 
virtual bool IsMask (CollisionType mask) const
 Determines if the object matches a collision bit-mask. More...
 
virtual bool IsDrawnByLevel () const
 Determines if the level should draw the game object. More...
 

Protected Member Functions

virtual void Initialize ()
 Initializes the ship.
 
virtual float GetSpeed () const
 Gets the speed of the projectile in pixels per second.
 
virtual void SetSpeed (const float speed)
 Sets the speed of the ship. More...
 
virtual void SetMaxHitPoints (const float hitPoints)
 Sets the maximum hit points of the ship. More...
 
virtual void FireWeapons (TriggerType type=TriggerType::ALL)
 Fires the ship's weapons. More...
 
virtual WeaponGetWeapon (const int index)
 Gets the weapon at the specified index. More...
 
- Protected Member Functions inherited from ShooterLibrary::GameObject
virtual void SetCollisionRadius (const int radius)
 Sets the collision radius for the object. More...
 
virtual void SetPosition (const float x, const float y)
 Sets the screen position of the object. More...
 
virtual void SetPosition (const Vector2 &position)
 Sets the screen position of the object. More...
 
virtual void TranslatePosition (const float x, const float y)
 Offsets the current screen position of the object. More...
 
virtual void TranslatePosition (const Vector2 &offset)
 Offsets the current screen position of the object. More...
 
virtual bool IsOnScreen () const
 Determines if the game object is on the screen. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ShooterLibrary::GameObject
static void SetCurrentLevel (Level *pLevel)
 Sets the current game level. More...
 
static LevelGetCurrentLevel ()
 Gets the current level. More...
 

Detailed Description

Base class for all ships.

Member Function Documentation

◆ AttachWeapon()

void ShooterLibrary::Ship::AttachWeapon ( Weapon pWeapon,
Vector2  position 
)
virtual

Attaches a weapon to the ship.

Parameters
pWeaponThe weapon to attach.
positionThe position, on the ship, to attach the weapon.

◆ Draw()

virtual void ShooterLibrary::Ship::Draw ( SpriteBatch *  pSpriteBatch)
pure virtual

Called when the game determines it is time to draw a frame.

Parameters
pSpriteBatchThe game's sprite batch, used for rendering.

Implemented in Sample::PlayerShip, ShooterLibrary::PlayerShip, Sample::BioEnemyShip, and ShooterLibrary::EnemyShip.

◆ FireWeapons()

void ShooterLibrary::Ship::FireWeapons ( TriggerType  type = TriggerType::ALL)
protectedvirtual

Fires the ship's weapons.

Parameters
typeThe type mask for weapons that should be fired.

◆ GetCollisionType()

virtual CollisionType ShooterLibrary::Ship::GetCollisionType ( ) const
pure virtual

Gets the collision type mask.

Returns
Returns bit-mask value for the collision type.
See also
CollisionTypes
CollisionManager

Implements ShooterLibrary::GameObject.

Implemented in ShooterLibrary::PlayerShip, and ShooterLibrary::EnemyShip.

◆ GetWeapon()

virtual Weapon* ShooterLibrary::Ship::GetWeapon ( const int  index)
inlineprotectedvirtual

Gets the weapon at the specified index.

Parameters
indexThe index of the desired weapon.
Returns
Returns a pointer to the specified weapon.

◆ Hit()

void ShooterLibrary::Ship::Hit ( const float  damage)
virtual

Hits the ship, dealing damage to it.

Parameters
damageThe amount of damage to inflict.

Reimplemented from ShooterLibrary::GameObject.

Reimplemented in Sample::PlayerShip, ShooterLibrary::EnemyShip, and Sample::BioEnemyShip.

◆ IsInvulnurable()

virtual bool ShooterLibrary::Ship::IsInvulnurable ( ) const
inlinevirtual

Determines if the ship takes damage.

Returns
Returns true if the ship is invulnurable (does not take damage), false otherwise.

◆ SetInvulnurable()

virtual void ShooterLibrary::Ship::SetInvulnurable ( bool  isInvulnurable = true)
inlinevirtual

Sets whether or not the ship takes damage.

Parameters
isInvulnurablePass true to make the ship invulnurable (does not take damage), of false to make the ship take damage.

◆ SetMaxHitPoints()

virtual void ShooterLibrary::Ship::SetMaxHitPoints ( const float  hitPoints)
inlineprotectedvirtual

Sets the maximum hit points of the ship.

Parameters
hitPointsThe desired hit point maximum.

◆ SetSpeed()

virtual void ShooterLibrary::Ship::SetSpeed ( const float  speed)
inlineprotectedvirtual

Sets the speed of the ship.

Parameters
speedThe desired speed in pixels per second.

◆ ToString()

virtual std::string ShooterLibrary::Ship::ToString ( ) const
inlinevirtual

Gets a string representation of the ship.

Returns
Returns a string displaying the type of object.

Implements ShooterLibrary::GameObject.

Reimplemented in ShooterLibrary::EnemyShip, and ShooterLibrary::PlayerShip.

◆ Update()

void ShooterLibrary::Ship::Update ( const GameTime pGameTime)
virtual

Updates the game object.

Parameters
pGameTimeTiming values including time since last update.

Reimplemented in Sample::PlayerShip, ShooterLibrary::PlayerShip, Sample::BioEnemyShip, and ShooterLibrary::EnemyShip.


The documentation for this class was generated from the following files: