Changeset 9330
- Timestamp:
- Jul 22, 2012, 7:23:51 PM (12 years ago)
- Location:
- code/branches/presentation2012merge/src/modules/tetris
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2012merge/src/modules/tetris/Tetris.cc
r9329 r9330 74 74 75 75 this->player_ = NULL; 76 this->endGameCriteria_ = 0.0f;77 76 this->setHUDTemplate("TetrisHUD"); 78 77 this->futureBrick_ = 0; … … 117 116 if((this->activeBrick_ != NULL)&&(!this->hasEnded())) 118 117 { 119 this->endGameCriteria_ += dt;120 118 if(!this->isValidBrickPosition(this->activeBrick_)) 121 119 { … … 125 123 this->activeBrick_->releaseStones(this->center_); 126 124 this->findFullRows(); 127 if(this->endGameCriteria_ < 0.1f) //end game if two bricks are created within a 0.1s interval. 128 this->end(); 129 else 130 this->startBrick(); 131 this->endGameCriteria_ = 0.0f; 125 this->startBrick(); 132 126 } 133 127 } … … 378 372 // create a new future brick 379 373 this->createBrick(); 374 375 // check if the new brick is in a valid position, otherwise end the game 376 if (!this->isValidBrickPosition(this->activeBrick_)) 377 this->end(); 380 378 } 381 379 -
code/branches/presentation2012merge/src/modules/tetris/Tetris.h
r9329 r9330 97 97 98 98 Timer starttimer_; //!< A timer to delay the start of the game. 99 float endGameCriteria_; //<! Works as a timer which is resetted, whenever a brick is created.100 99 }; 101 100 }
Note: See TracChangeset
for help on using the changeset viewer.