Arcade Shooter
Public Member Functions | List of all members
Sample::PlayerShip Class Reference

Class for player ships. More...

#include <PlayerShip.h>

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

Public Member Functions

 PlayerShip (const uint8_t playerIndex)
 Instantiate a player ship object. More...
 
virtual void LoadContent (ResourceManager *pResourceManager)
 Called when resources need to be loaded. More...
 
virtual void Update (const GameTime *pGameTime)
 Called when the game has determined that game logic needs to be processed. More...
 
virtual void Draw (SpriteBatch *pSpriteBatch)
 Called when the game determines it is time to draw a frame. More...
 
virtual void HandleInput (const InputState *pInput)
 Called when the game has determined that player input needs to be processed. More...
 
virtual void Hit (const float damage)
 Hits the ship, dealing damage to it. More...
 
virtual void Initialize (Level *pLevel)
 Initializes the player ship at the start of the level. More...
 
virtual void SetAITarget (Vector2 position)
 Sets the target position for the AI to move to. More...
 
virtual Vector2 GetHalfDimensions () const
 Gets the half dimensions of the game object. More...
 
virtual bool IsAIControlled () const
 Determines if the player ship is currently being controlled by AI. More...
 
virtual void PowerUp ()
 Powers up the ship. More...
 
- Public Member Functions inherited from ShooterLibrary::PlayerShip
 PlayerShip (const uint8_t playerIndex)
 Instantiate a player ship object. More...
 
virtual void SetDesiredDirection (const Vector2 direction)
 Set the desired player direction. More...
 
virtual std::string ToString () const
 Gets a string representation of the player ship. More...
 
virtual CollisionType GetCollisionType () const
 Gets the collision type mask. More...
 
virtual void ConfineToScreen (const bool isConfined=true)
 Confines the player ship to the screen. More...
 
virtual void SetPlayerIndex (const uint8_t index)
 Sets the index of the player that controls the ship. More...
 
virtual uint8_t GetPlayerIndex () const
 Gets the index of the player that controls the ship. More...
 
- Public Member Functions inherited from ShooterLibrary::Ship
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 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 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...
 

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...
 
- Protected Member Functions inherited from ShooterLibrary::PlayerShip
virtual void SetResponsiveness (const float responsiveness)
 Set the responsiveness of the player ship. More...
 
virtual float GetResponsiveness () const
 Get the responsiveness of the player ship. More...
 
virtual Vector2 GetDesiredDirection () const
 Get the desired player direction. More...
 
- Protected Member Functions inherited from ShooterLibrary::Ship
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...
 

Detailed Description

Class for player ships.

Constructor & Destructor Documentation

◆ PlayerShip()

Sample::PlayerShip::PlayerShip ( const uint8_t  playerIndex)

Instantiate a player ship object.

Parameters
playerIndexThe controlling player's index.

Member Function Documentation

◆ Draw()

virtual void Sample::PlayerShip::Draw ( SpriteBatch *  pSpriteBatch)
virtual

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

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

Implements ShooterLibrary::PlayerShip.

◆ GetHalfDimensions()

Vector2 Sample::PlayerShip::GetHalfDimensions ( ) const
virtual

Gets the half dimensions of the game object.

Returns
Returns the half dimensions of the object.

Implements ShooterLibrary::PlayerShip.

◆ HandleInput()

virtual void Sample::PlayerShip::HandleInput ( const InputState *  pInput)
virtual

Called when the game has determined that player input needs to be processed.

Parameters
pInputThe current state of all player input devices.

Reimplemented from ShooterLibrary::PlayerShip.

◆ Hit()

void Sample::PlayerShip::Hit ( const float  damage)
virtual

Hits the ship, dealing damage to it.

Parameters
damageThe amount of damage to inflict.

Reimplemented from ShooterLibrary::Ship.

◆ Initialize()

void Sample::PlayerShip::Initialize ( Level pLevel)
virtual

Initializes the player ship at the start of the level.

Parameters
pLevelThe current level.

◆ IsAIControlled()

virtual bool Sample::PlayerShip::IsAIControlled ( ) const
inlinevirtual

Determines if the player ship is currently being controlled by AI.

Returns
Returns true if the ship being is controlled by AI, false otherwise.

◆ LoadContent()

void Sample::PlayerShip::LoadContent ( ResourceManager pResourceManager)
virtual

Called when resources need to be loaded.

Parameters
pResourceManagerThe game's resource manager, used for loading and managing game resources.

◆ PowerUp()

virtual void Sample::PlayerShip::PowerUp ( )
inlinevirtual

Powers up the ship.

◆ SetAITarget()

virtual void Sample::PlayerShip::SetAITarget ( Vector2  position)
inlinevirtual

Sets the target position for the AI to move to.

Parameters
positionThe position to move to.

◆ Update()

virtual void Sample::PlayerShip::Update ( const GameTime *  pGameTime)
virtual

Called when the game has determined that game logic needs to be processed.

Parameters
pGameTimeTiming values including time since last update.

Reimplemented from ShooterLibrary::PlayerShip.


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