/* enemies.h - Unsavoury characters who make the player's life harder Copyright (C) 2006 Mark boyd This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be fun to play, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "movers.h" class enemy:public mover { public: virtual int take_hit(int damage); protected: enemy() {m_hitpoints=1;m_dam_red=0;m_score=0;} int m_hitpoints; int m_dam_red; int m_score; private: virtual void notify_dead(){}; }; class turret:public enemy //number 1 { public: enum direction { UP,DOWN,LEFT,RIGHT }; turret(direction); void do_stuff(float time_interval); SDL_Surface* pic() const {return m_pic;} void notify_dead(); private: SDL_Surface *m_pic; int m_direction; float m_reload; }; class t_shot:public enemy { public: t_shot(); void do_stuff(float time_interval); bool does_arena_collisions() const {return true;} void notify_collision(arena_t); SDL_Surface* pic() const {return m_pic;} private: SDL_Surface *m_pic; float m_life_expectancy; }; class bobbler:public enemy { public: bobbler(); void do_stuff(float time_interval); SDL_Surface* pic() const {return m_pic;} void notify_dead(); private: SDL_Surface *m_pic; int m_phase; }; class miner:public enemy { public: miner(); void detonate(); void do_stuff(float time_interval); SDL_Surface* pic() const {return m_pic;} bool does_arena_collisions() const {return true;} bool does_collisions(mover *m) const; void notify_collision(arena_t); void notify_collision(mover *m); void notify_dead(); private: SDL_Surface *m_pic; }; class graldor:public enemy { public: graldor(); void do_stuff(float time_interval); SDL_Surface* pic() const {return m_pic;} bool does_arena_collisions() const; void notify_collision(arena_t); void notify_dead(); private: SDL_Surface *m_pic; float m_reload; float m_firing; }; class baby_graldor:public enemy { public: baby_graldor(); void do_stuff(float time_interval); SDL_Surface* pic() const {return m_pic;} bool does_arena_collisions() const {return true;} void notify_collision(arena_t); void notify_dead(); private: SDL_Surface *m_pic; }; class invader:public enemy { public: invader(float left, float right); void do_stuff(float time_interval); SDL_Surface* pic() const {return m_pic;} void notify_dead(); private: float m_timer; float m_left; float m_right; float m_dir; SDL_Surface *m_pic; }; class ufo:public enemy { public: //UFO likes to be at a certain height, and moves horizontally between "left" and "right" ufo(float desired_y, int left, int right); SDL_Surface* pic() const {return m_pic;} void do_stuff(float time_interval); void notify_dead(); private: SDL_Surface *m_pic; float m_timer; float m_desired_y; float m_left; float m_right; }; class ufo_rocket:public enemy { public: ufo_rocket(); SDL_Surface* pic() const {return m_pic;} bool does_arena_collisions() const {return true;} void notify_collision(arena_t); void notify_dead(); private: SDL_Surface *m_pic; };