-
Notifications
You must be signed in to change notification settings - Fork 4
Enemy Set
This Documentation is from a code still under heavy development, you may find errors,sudden changes or the answer to life,universe and everything
###Overview All enemies should be an enemy instance with attributes given by enemy set, which will spawn new enemies and correctly delete all information related to bitmaps at the end
Name | Version | Header | Implementation |
---|---|---|---|
Enemy Attributes | 0.7.6 | enemy_set.h | enemy_set.cpp |
Before reading more about enemy set, remember to check the pages about [enemy attributes](Enemy Attributes), enemies as well as the reference
###Variables Private
-
string name
name of the set, currently it's not necessary, but it is recommended to assign a name to each enemy set -
map<string,enemy_attributes> enemies
stores all the different [enemies attributes](Enemy Attribute), the key of the map is the name of the enemy -
const ALLEGRO_TIMER *timer
timer that will be used to format the speed of all enemies spawned
###Constructors
-
enemy_set()
default constructor -
enemy_set(const string &name,const ALLEGRO_TIMER* timer)
constructor with name and timer -
enemy_set(const string &name,const vector<enemy_attributes> &enemy_list,const ALLEGRO_TIMER* timer)
full constructor, with attributes in a vector -
enemy_set(const string &name,const enemy_attributes &enemy_list,const ALLEGRO_TIMER* timer)
constructor with one enemy attributes
###Destructor
-
~enemy_set()
the destructor clears all the information and destroy all the bitmaps under no circumstances an enemy should be used after enemy set is destroyed, even if it has been spawned before (if you do that, i won't like you anymore) This destructor will not destroy or change the Allegro timer
###Methods Public
-
void set_name(const string &name)
change the enemy_set name -
void add_enemy(const enemy_attributes &info)
adds new enemy info, automatically sets the attribute name as key of the map -
void set_timer(const ALLEGRO_TIMER *timer)
sets the timer to given timer This will change speed of future spawned enemies, but won't modify already spawned enemies -
void remove_enemy(const string &name)
removes given enemy without destroying its attributes -
void clear()
clear all data of the set (not destroying the data) this is useful if you plan to copy or remove the set but you want to maintain the enemies) -
string get_name() const
returns the name of the enemy set -
unsigned int size() const
returns the size of enemy_set (number of different [enemy attributes](Enemy Attributes) in the set -
bool empty() const
return true if there are no tributes in enemy_set -
bool is_enemy(const string &name) const
return true if enemy with given name is in the set -
enemy spawn_enemy(const string &name,unsigned int level,double posx,double posy)
returns the enemy with given name, spawned int given position (will show an error and return a null enemy if name is not found in the map) -
bool check() const
checks that all the class is working properly, returns false if not
Don't Crush My Castle Wiki is under CC License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
_______________________
/ Don't Crush My Castle \
\ is a cool name /
-----------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
DCmC Wiki 0.7.6
- [Home] (Home)
- [Getting Started] (Getting Started)
- Documentation
- Reference
- Attributions