00001 #ifndef MONSTER_H 00002 #define MONSTER_H 00003 00004 #include <stdlib.h> 00005 #include <qpixmap.h> 00006 #include <qwidget.h> 00007 00008 #include "board.h" 00009 00010 enum monsterState { dangerous, harmless, rem, arrested }; 00011 00012 class Monster { 00013 public: 00014 Monster(Board *b, int mid = 0); 00015 void setMaxPixmaps(int maxBody, int maxEyes); 00016 void setArrested(int ticks, int duration); 00017 void setDangerous(int ticks, int IQ); 00018 void setHarmless(int ticks, int hDuration, int wDuration); 00019 void setREM(int ticks); 00020 void setPosition(int pos); 00021 void setPrison(int pos); 00022 void setFreedom(int pos); 00023 void setDirection(int dir); 00024 monsterState state(); 00025 int position(); 00026 int direction(); 00027 int id(); 00028 bool move(); 00029 int body(); 00030 int eyes(); 00031 private: 00032 Board *board; 00033 int ID; // ID of monster (0 = 1st, 1 = 2nd ... 7 = last) 00034 int IQ; // Intelligence of movement (0 = dumb..180 = smart) 00035 00036 monsterState actualState; // The state of the monster 00037 00038 int pauseDuration; // Number of ticks before movement 00039 int pause; // actual ticks before moevment (0 = move) 00040 int dangerousPause; // pause in dangerous-state 00041 00042 int harmlessDuration; // Length of harmless-time in ticks 00043 int harmlessLeft; // rest of the time in harmless-state 00044 int warningDuration; // warningtime before monster get dangerous again 00045 00046 int arrestDuration; // Length of arrest in ticks 00047 int arrestLeft; // time left of arrest 00048 int arrestPause; // pause in arrest-state 00049 00050 int actualDirection; // actual direction of monster 00051 int lastDirection; // last direction, before no movement (X) 00052 int actualPosition; // actual position on board 00053 int lastPosition; // the last position of the monster 00054 int feetPosition; // left, right, left, right, ... 00055 int maxBodyPixmaps; 00056 int maxEyesPixmaps; 00057 int prisonPosition; // where to go, if arrested 00058 int freedomPosition; // where to go, if released from prison 00059 }; 00060 00061 #endif // MONSTER_H 00062
1.4.2