Space Fighter
A "shmup" game for Computer Programming C++
Loading...
Searching...
No Matches
EnemyShip Class Referenceabstract

Represents an enemy ship. More...

#include <EnemyShip.h>

Inheritance diagram for EnemyShip:

Public Member Functions

 EnemyShip ()
 Creates a new instance of EnemyShip.
 
virtual ~EnemyShip ()
 
virtual void Update (const GameTime &gameTime)
 Loads the content for the enemy ship.
 
virtual void Draw (SpriteBatch &spriteBatch)=0
 Draws the enemy ship.
 
virtual void Initialize (const Vector2 position, const double delaySeconds)
 Initializes the enemy ship.
 
virtual void Fire ()
 Fires a weapon from the enemy ship.
 
virtual void Hit (const float damage)
 Applies damage to the ship.
 
virtual std::string ToString () const
 Gets the string representation of the enemy ship.
 
virtual CollisionType GetCollisionType () const
 Gets the collision type of the enemy ship.
 
- Public Member Functions inherited from Ship
 Ship ()
 Creates a new instance of Ship.
 
virtual ~Ship ()
 
virtual bool IsInvulnurable () const
 To determine if the ship should take damage when hit.
 
virtual void SetInvulnurable (bool isInvulnurable=true)
 Sets the invulnerability of the ship.
 
virtual void AttachItem (IAttachment *item, Vector2 position)
 Attaches a weapon to the ship.
 
virtual float GetSpeed () const
 Gets the speed of the ship.
 
virtual void SetSpeed (const float speed)
 Sets the speed of the ship.
 
virtual void SetMaxHitPoints (const float hitPoints)
 Sets the max hit points of the ship.
 
virtual IAttachmentGetAttachment (const std::string &key)
 
virtual IAttachmentGetAttachment (const int index)
 
- Public Member Functions inherited from GameObject
 GameObject ()
 Instantiate a game object.
 
virtual ~GameObject ()
 
virtual bool IsActive () const
 Flag to determine if the object is active.
 
virtual void Activate ()
 Activate the object.
 
virtual void Deactivate ()
 Deactivate the object.
 
virtual Vector2GetPosition ()
 Get the position of the object.
 
virtual Vector2GetPreviousPosition ()
 Get the position of the object during the previous frame.
 
virtual Vector2 GetHalfDimensions () const
 Get the half dimensions of the object.
 
virtual uint32_t GetIndex () const
 Get the index of the object. Each object is assigned a unique ID when created, starting at 0.
 
virtual float GetCollisionRadius () const
 Get the collision radius of the object.
 
virtual bool HasMask (CollisionType mask) const
 Check if the object has a specific collision bit-mask.
 
virtual bool IsMask (CollisionType mask) const
 
virtual bool IsDrawnByLevel () const
 

Protected Member Functions

virtual double GetDelaySeconds () const
 Gets the delay before the enemy ship activates, to prevent all enemy ships from activating at the same time.
 
- Protected Member Functions inherited from Ship
virtual void Initialize ()
 Initializes the ship.
 
virtual void FireWeapons (TriggerType type=TriggerType::All)
 Fires the ship's weapons.
 
virtual WeaponGetWeapon (const std::string &key)
 Gets a weapon from the ship's weapon list.
 
virtual float GetHitPoints () const
 Gets the current hit points of the ship.
 
virtual float GetMaxHitPoints () const
 Gets the max hit points of the ship.
 
- Protected Member Functions inherited from GameObject
virtual void SetCollisionRadius (const int radius)
 
virtual void SetPosition (const float x, const float y)
 
virtual void SetPosition (const Vector2 &position)
 
virtual void TranslatePosition (const float x, const float y)
 
virtual void TranslatePosition (const Vector2 &offset)
 
virtual bool IsOnScreen () const
 

Additional Inherited Members

- Static Public Member Functions inherited from GameObject
static void SetCurrentLevel (Level *pLevel)
 Set the current level.
 
static LevelGetCurrentLevel ()
 Get the current level.
 

Detailed Description

Represents an enemy ship.

Definition at line 7 of file EnemyShip.h.

Constructor & Destructor Documentation

◆ EnemyShip()

EnemyShip::EnemyShip ( )

Creates a new instance of EnemyShip.

Definition at line 5 of file EnemyShip.cpp.

◆ ~EnemyShip()

virtual EnemyShip::~EnemyShip ( )
inlinevirtual

Definition at line 14 of file EnemyShip.h.

Member Function Documentation

◆ Draw()

virtual void EnemyShip::Draw ( SpriteBatch & spriteBatch)
pure virtual

Draws the enemy ship.

Parameters
spriteBatchA reference to the game's sprite batch, used for rendering.

Implements Ship.

Implemented in BioEnemyShip.

◆ Fire()

virtual void EnemyShip::Fire ( )
inlinevirtual

Fires a weapon from the enemy ship.

Definition at line 31 of file EnemyShip.h.

◆ GetCollisionType()

virtual CollisionType EnemyShip::GetCollisionType ( ) const
inlinevirtual

Gets the collision type of the enemy ship.

Returns
Returns the collision type of the enemy ship.

Implements Ship.

Definition at line 43 of file EnemyShip.h.

◆ GetDelaySeconds()

virtual double EnemyShip::GetDelaySeconds ( ) const
inlineprotectedvirtual

Gets the delay before the enemy ship activates, to prevent all enemy ships from activating at the same time.

Returns
Returns the delay before the enemy ship activates.

Definition at line 51 of file EnemyShip.h.

◆ Hit()

void EnemyShip::Hit ( const float damage)
virtual

Applies damage to the ship.

Parameters
damageThe amount of damage to apply.

Reimplemented from Ship.

Definition at line 43 of file EnemyShip.cpp.

◆ Initialize()

void EnemyShip::Initialize ( const Vector2 position,
const double delaySeconds )
virtual

Initializes the enemy ship.

Parameters
positionThe starting position of the enemy ship.
delaySecondsThe delay before the enemy ship activates.

Definition at line 34 of file EnemyShip.cpp.

◆ ToString()

virtual std::string EnemyShip::ToString ( ) const
inlinevirtual

Gets the string representation of the enemy ship.

Returns
Returns the string "Enemy Ship".

Reimplemented from Ship.

Definition at line 39 of file EnemyShip.h.

◆ Update()

void EnemyShip::Update ( const GameTime & gameTime)
virtual

Loads the content for the enemy ship.

Parameters
resourceManagerA reference to the game's resource manager, used for loading and managing game assets (resources).

Reimplemented from Ship.

Reimplemented in BioEnemyShip.

Definition at line 12 of file EnemyShip.cpp.


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