Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Enemy Class Reference
#include <enemies.h>
Inherits GameObject.
Public Member Functions | |
Enemy () | |
void | spawn () |
Enemy spawn function. | |
void | die () |
enemy death sound and status reset. | |
void | updateAndDraw () |
Draws and updates enemy sprites on the screen and substracts the score if the ship leaves the screen limits. | |
void | spawn (Point spawn_pos) |
Activates the object at the given postion. | |
Data Fields | |
bool | dead |
sets if to true when enemy is hit to draw explossion. | |
int | dead_counter |
For drawing small explosion animatioin. | |
int | blast_countdown |
A variable for delaying the enemy shots. | |
int | enemy_speed |
How fast should an enemy move. |
Detailed Description
Enemy Class.
A class to describe the states of an enemy ship.
- Date:
- 15/04/2019
Definition at line 10 of file enemies.h.
Constructor & Destructor Documentation
Enemy | ( | ) |
Member Function Documentation
void die | ( | ) |
void spawn | ( | Point | spawn_pos ) | [inherited] |
Activates the object at the given postion.
- Parameters:
-
spawn_pos sets position of x and y into pos (Point).
Definition at line 19 of file gameobject.h.
void spawn | ( | ) |
void updateAndDraw | ( | ) |
Draws and updates enemy sprites on the screen and substracts the score if the ship leaves the screen limits.
The function draws this enemy ship on the screen, and changes their x and y positions each time the function is called. If ship is dead then it draws enemy explosion animation and then disables it. Disables the ship when it leaves the screen limits and substracts the in game score by -50.
Field Documentation
int blast_countdown |
bool dead |
int dead_counter |
int enemy_speed |
Generated on Wed Dec 20 2023 20:30:17 by
