00001 #ifndef FRUIT_H 00002 #define FRUIT_H 00003 00004 #include <stdlib.h> 00005 00006 #include "board.h" 00007 00008 enum fruitState { inactive, active, eaten }; 00009 00010 class Fruit { 00011 public: 00012 Fruit(Board *b); 00013 void setEaten(int duration); 00014 void setLevel(int level, int wDuration, int fDuration, int ticks = -1); 00015 void setMaxPixmaps(int max); 00016 void setMovement(int entry, int tunnel, int iq); 00017 void setPosition(int pos); 00018 void setDirection(int dir); 00019 fruitState state(); 00020 int position(); 00021 int direction(); 00022 bool move(bool activate=FALSE); 00023 int pix(); 00024 00025 private: 00026 Board *board; 00027 00028 int IQ; // Intelligence of movement (0 = dumb..180=smart) 00029 00030 fruitState actualState; // the state of fruit 00031 00032 int pauseDuration; // number of ticks before next movement 00033 int pause; // actual ticks before movement (0 = move) 00034 00035 int timeLeft; // Ticks remaining of current state 00036 00037 int waitDuration; // Time before fruit appears 00038 int fruitDuration; // Length of active-time in ticks 00039 00040 int actualDirection; // actual direction of the fruit 00041 int actualPosition; // actual position on board 00042 int lastPosition; // the last position of the fruit 00043 int actualLevel; // level for kind of fruit and score 00044 int actualPix; 00045 int maxPixmaps; // Number of Pixmaps (1..) 00046 00047 int entryPosition; // where to come in 00048 int homePosition; // where to go, on the way in 00049 int tunnelPosition; // where to exit 00050 }; 00051 00052 #endif // FRUIT_H 00053
1.4.2