1 /************************************************************************* 2 3 "I Have No Tomatoes" 4 Copyright (c) 2004, Mika Halttunen 5 6 This software is provided 'as-is', without any express or implied 7 warranty. In no event will the authors be held liable for any damages 8 arising from the use of this software. 9 10 Permission is granted to anyone to use this software for any purpose, 11 including commercial applications, and to alter it and redistribute 12 it freely, subject to the following restrictions: 13 14 1. The origin of this software must not be misrepresented; you must 15 not claim that you wrote the original software. If you use this 16 software in a product, an acknowledgment in the product documentation 17 would be appreciated but is not required. 18 19 2. Altered source versions must be plainly marked as such, and must 20 not be misrepresented as being the original software. 21 22 3. This notice may not be removed or altered from any source 23 distribution. 24 25 26 Mika Halttunen <lsoft@mbnet.fi> 27 28 *************************************************************************/ 29 30 #ifndef ENEMY_H 31 #define ENEMY_H 32 33 #include <list> 34 using namespace std; 35 36 #include "pathfinder.h" 37 #include "player.h" 38 39 // Number of enemies 40 #define ENEMY_AMOUNT 5 41 42 43 // Enemy animations 44 extern GLuint enemy1_anim; 45 46 47 // Enemy class 48 class ENEMY { 49 public: 50 int x, y; // Tile position 51 int tx, ty; // Target tile position 52 float offset; // Current offset 53 float speed; // Moving speed 54 int dir; // Direction 55 int nextdir; // Next direction 56 57 int turning; // Turning? (0 == false, 1 == raising up, 2 == turning, 3 == going down) 58 float turning_raise; // Raised position when turning 59 int turning_counter; // Counter for the turning animation 60 61 float size; // Sprite size 62 float anim; // Animation counter 63 int type; // Enemy type 64 bool alive; // Is the enemy alive? 65 66 bool dying; // Is the dying animation on? 67 float die_anim; // Die animation counter 68 69 int chase; // Are we chasing the players? 70 71 bool burning; // Are we burning? 72 int burn_time; // Burning time 73 74 bool kicked; // Has the potatoman kicked us? 75 76 PATHFINDER pf; // Path finder 77 int path_pos; // Current position along the path 78 79 80 // Functions 81 void clear(); // Clear the enemy 82 void move(); // Move the enemy 83 void draw(); // Draw the enemy 84 void die(); // Kill the enemy 85 void look_player(); // Look for the player and chase him 86 float get_real_x(); // Get current x with offset 87 float get_real_y(); // Get current y with offset 88 }; 89 90 // Enemy list 91 extern list<ENEMY> enemylist; 92 93 94 void load_enemies(); 95 void clear_enemies(); 96 void draw_enemies(); 97 void move_enemies(); 98 99 #endif 100 101