- Timestamp:
- Nov 27, 2017, 3:00:47 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.h
r11596 r11598 21 21 * 22 22 * Author: 23 * Florian Zinggeler 24 * Co-authors: 25 * ... 23 * Leo Mehr Holz 24 * Pascal Schärli 26 25 * 27 26 */ … … 39 38 40 39 #include "gametypes/Deathmatch.h" 41 #include "tools/Timer.h"42 40 #include <vector> 43 41 … … 77 75 void setCenterpoint(FlappyOrxCenterPoint* center); 78 76 79 int getLives(){return this->lives;}80 int getLevel(){return this->level;}81 77 int getPoints(){return this->point;} 82 int getMultiplier(){return this->multiplier;} 83 84 void costLife(); 78 85 79 void levelUp(); 86 void addPoints(int numPoints); 87 // checks if multiplier should be reset. 88 void comboControll(); 89 80 90 81 bool isDead(); 91 82 void setDead(bool value); … … 93 84 FlappyOrxShip* getPlayer(); 94 85 95 int lives;96 int multiplier;97 86 bool bEndGame; 98 bool bShowLevel;99 87 bool bIsDead; 100 88 bool firstGame; … … 106 94 107 95 private: 108 void toggleShowLevel(){bShowLevel = !bShowLevel;}109 110 const static int nAst = 7;111 Circle Asteroids[nAst];96 97 const static int nCircles = 6; 98 int circlesUsed; 99 Circle circles[nCircles]; 112 100 113 void ClearAsteroids(){ 114 for(int i = 0; i<this->nAst; i++){ 115 Asteroids[i].r=0; 116 } 117 } 118 119 120 bool Collision(Circle &c1, Circle &c2){ 121 if(c1.r==0 || c2.r==0) 122 return false; 123 int x = c1.x - c2.x; 124 int y = c1.y - c2.y; 125 int r = c1.r + c2.r; 126 127 return x*x+y*y<r*r*1.5; 128 } 129 130 int addIfPossible(Circle c){ 131 int i; 132 for(i=0; i<this->nAst && this->Asteroids[i].r!=0;i++){ 133 if(Collision(c,this->Asteroids[i])){ 134 return 0; 135 } 136 } 137 if(i==nAst) 138 return 2; 139 this->Asteroids[i].x=c.x; 140 this->Asteroids[i].y=c.y; 141 this->Asteroids[i].r=c.r; 142 createAsteroid(c); 143 return 1; 144 } 145 146 101 void clearCircles(); 102 bool circleCollision(Circle &c1, Circle &c2); 103 int addIfPossible(Circle c); 147 104 148 105 WeakPtr<FlappyOrxCenterPoint> center_; 149 106 WeakPtr<FlappyOrxShip> player; 150 107 151 Timer enemySpawnTimer;152 Timer comboTimer;153 Timer showLevelTimer;154 //Context* context;155 108 int level; 156 109 int point;
Note: See TracChangeset
for help on using the changeset viewer.