Space Fighter
A "shmup" game for Computer Programming C++
Loading...
Searching...
No Matches
EnemyShip.h
Go to the documentation of this file.
1
2#pragma once
3
4#include "Ship.h"
5
7class EnemyShip : public Ship
8{
9
10public:
11
13 EnemyShip();
14 virtual ~EnemyShip() { }
15
19 virtual void Update(const GameTime& gameTime);
20
23 virtual void Draw(SpriteBatch& spriteBatch) = 0;
24
28 virtual void Initialize(const Vector2 position, const double delaySeconds);
29
31 virtual void Fire() { }
32
35 virtual void Hit(const float damage);
36
39 virtual std::string ToString() const { return "Enemy Ship"; }
40
44
45
46protected:
47
51 virtual double GetDelaySeconds() const { return m_delaySeconds; }
52
53
54private:
55
56 double m_delaySeconds = 0;
57
58 double m_activationSeconds = 0;
59
60
61};
Represents a type of collision.
static const CollisionType Ship
static const CollisionType Enemy
Represents an enemy ship.
Definition EnemyShip.h:8
virtual void Fire()
Fires a weapon from the enemy ship.
Definition EnemyShip.h:31
virtual void Draw(SpriteBatch &spriteBatch)=0
Draws the enemy ship.
virtual void Hit(const float damage)
Applies damage to the ship.
Definition EnemyShip.cpp:43
virtual CollisionType GetCollisionType() const
Gets the collision type of the enemy ship.
Definition EnemyShip.h:43
virtual void Update(const GameTime &gameTime)
Loads the content for the enemy ship.
Definition EnemyShip.cpp:12
EnemyShip()
Creates a new instance of EnemyShip.
Definition EnemyShip.cpp:5
virtual ~EnemyShip()
Definition EnemyShip.h:14
virtual double GetDelaySeconds() const
Gets the delay before the enemy ship activates, to prevent all enemy ships from activating at the sam...
Definition EnemyShip.h:51
virtual std::string ToString() const
Gets the string representation of the enemy ship.
Definition EnemyShip.h:39
Contains timing values for game updates and rendering.
Definition GameTime.h:21
Enables a group of sprites to be drawn using the same settings.
Definition SpriteBatch.h:48
Defines a vector with 2 components (x and y).
Definition Vector2.h:21
Represents a ship in the game.
Definition Ship.h:9
virtual void Initialize()
Initializes the ship.
Definition Ship.cpp:56