00001 #ifndef PACMAN_H 00002 #define PACMAN_H 00003 00004 #include <stdlib.h> 00005 #include <qpixmap.h> 00006 #include <qwidget.h> 00007 00008 #include "board.h" 00009 00010 enum pacmanState { alive }; 00011 00012 class Pacman { 00013 public: 00014 Pacman(Board *b); 00015 void init(bool Demo = FALSE); 00016 void setMaxPixmaps(int max); 00017 void setAlive(int ticks); 00018 void setPosition(int pos); 00019 void setDirection(int dir, bool forced = FALSE); 00020 void setDemo(bool yes); 00021 pacmanState state(); 00022 int position(); 00023 int direction(); 00024 bool move(); 00025 int pix(); 00026 00027 private: 00028 Board *board; 00029 00030 pacmanState actualState; // the state of pacman 00031 bool demo; // real life or just demo 00032 00033 int pauseDuration; // number of ticks before next movement 00034 int pause; // actual ticks before movement (0=move) 00035 00036 int actualDirection; // actual direction of pacman 00037 int nextDirection; // where he wants to go 00038 int lastPix; // last Pixmap-index before no movement 00039 int maxPixmaps; // Number of Pixmaps (1..) 00040 int actualPosition; // actual position on board 00041 int lastPosition; // the last position of pacman 00042 int mouthPosition; // eating 00043 00044 }; 00045 00046 #endif // PACMAN_H 00047
1.4.2