Arcade Shooter
PlayerShip.h
1 
2 /* . ,'`. .
3  . .." _.-;' ⁄‚ `. . `
4  _.-"`.##%"_.--" ,' ⁄` `. "#" ___,,od000
5  ,'"-_ _.-.--"\ ,' `-_ '%#%',,/00000000000
6  ,' |_.' )`/- __..--""`-_`-._ J L/00000000000000
7  . + ,' _.-" / / _-"" `-._`-_/___\///0000 000M
8  .'_.-"" ' :_/_.-' _,`-/__V__\0000 00MMM
9  . _-"" . ' _,/000\ | /000 0MMMMM
10 _-" . ' . . ,/ 000\ | /000000000MMMMM
11  ` Shooter Library ' ,/ 000\|/000000000MMMMMM
12 . © 2017 - Shuriken Studios LLC ,/0 00000|0000000000MMMMMM */
13 
14 #pragma once
15 
16 namespace ShooterLibrary
17 {
18 
20  class PlayerShip : public Ship
21  {
22 
23  public:
24 
25 
28  PlayerShip(const uint8_t playerIndex);
29 
30  virtual ~PlayerShip() { }
31 
34  virtual void Update(const GameTime *pGameTime);
35 
38  virtual void Draw(SpriteBatch *pSpriteBatch) = 0;
39 
42  virtual void HandleInput(const InputState *pInput);
43 
46  virtual void SetDesiredDirection(const Vector2 direction) { m_desiredDirection.Set(direction); }
47 
50  virtual std::string ToString() const { return "Player Ship"; }
51 
54  virtual Vector2 GetHalfDimensions() const = 0;
55 
61 
64  virtual void ConfineToScreen(const bool isConfined = true) { m_isConfinedToScreen = isConfined; }
65 
68  virtual void SetPlayerIndex(const uint8_t index) { m_playerIndex = index; }
69 
72  virtual uint8_t GetPlayerIndex() const { return m_playerIndex; }
73 
74 
75  protected:
76 
80  virtual void SetResponsiveness(const float responsiveness);
81 
84  virtual float GetResponsiveness() const { return m_responsiveness; }
85 
88  virtual Vector2 GetDesiredDirection() const { return m_desiredDirection; }
89 
90 
91  private:
92 
93  Vector2 m_desiredDirection;
94  Vector2 m_velocity;
95 
96  float m_responsiveness;
97 
98  bool m_isConfinedToScreen;
99 
100  uint8_t m_playerIndex;
101 
102  };
103 }
virtual void Update(const GameTime *pGameTime)
Called when the game determines it is time to draw a frame.
virtual uint8_t GetPlayerIndex() const
Gets the index of the player that controls the ship.
Definition: PlayerShip.h:72
virtual void SetPlayerIndex(const uint8_t index)
Sets the index of the player that controls the ship.
Definition: PlayerShip.h:68
virtual void SetResponsiveness(const float responsiveness)
Set the responsiveness of the player ship.
Definition: PlayerShip.cpp:100
Shooter Library is a library of classes, interfaces, and value types that provides a foundation for d...
Definition: Background.h:16
virtual Vector2 GetDesiredDirection() const
Get the desired player direction.
Definition: PlayerShip.h:88
virtual CollisionType GetCollisionType() const
Gets the collision type mask.
Definition: PlayerShip.h:60
virtual Vector2 GetHalfDimensions() const =0
Gets the half dimensions of the game object.
virtual void SetDesiredDirection(const Vector2 direction)
Set the desired player direction.
Definition: PlayerShip.h:46
static const CollisionType SHIP
Represents a ship.
Definition: CollisionType.h:33
PlayerShip(const uint8_t playerIndex)
Instantiate a player ship object.
Definition: PlayerShip.cpp:19
virtual void ConfineToScreen(const bool isConfined=true)
Confines the player ship to the screen.
Definition: PlayerShip.h:64
Base class for player ships.
Definition: PlayerShip.h:20
virtual void Draw(SpriteBatch *pSpriteBatch)=0
Called when the game determines it is time to draw a frame.
virtual float GetResponsiveness() const
Get the responsiveness of the player ship.
Definition: PlayerShip.h:84
virtual void HandleInput(const InputState *pInput)
Called when the game has determined that player input needs to be processed.
static const CollisionType PLAYER
Represents a player.
Definition: CollisionType.h:30
virtual std::string ToString() const
Gets a string representation of the player ship.
Definition: PlayerShip.h:50
Base class for all ships.
Definition: Ship.h:22
Defines the types of game objects that can collide with each other.
Definition: CollisionType.h:20