Changeset 9081
- Timestamp:
- Apr 5, 2012, 11:12:08 AM (13 years ago)
- Location:
- code/branches/pCuts/src/modules
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pCuts/src/modules/pong/Pong.cc
r9016 r9081 284 284 285 285 // If a palyer gets 21 points, he won the game -> end of game 286 286 287 287 PlayerInfo* player1 = this->getLeftPlayer(); 288 288 PlayerInfo* player2 = this->getRightPlayer(); -
code/branches/pCuts/src/modules/tetris/TetrisStone.cc
r8706 r9081 37 37 #include "core/XMLPort.h" 38 38 39 #include <OgreSceneNode.h> 40 39 41 #include "Tetris.h" 40 42 … … 47 49 Constructor. Registers and initializes the object. 48 50 */ 49 TetrisStone::TetrisStone(BaseObject* creator) : ControllableEntity(creator)51 TetrisStone::TetrisStone(BaseObject* creator) : Pawn(creator) 50 52 { 51 53 RegisterObject(TetrisStone); 52 54 53 55 this->size_ = 10.0f; 54 56 this->delay_ = false; 55 57 this->delayTimer_.setTimer(0.2f, false, createExecutor(createFunctor(&TetrisStone::enableMovement, this))); 58 this->lockRotation_ = false; 59 56 60 } 57 61 … … 64 68 void TetrisStone::moveFrontBack(const Vector2& value) 65 69 { 66 if(value.x < 0) 70 if(value.x < 0) //speedup on key down 67 71 { 68 72 this->setVelocity(this->getVelocity()*1.1); 73 } 74 else if(!this->lockRotation_) //rotate when key up is pressed 75 { 76 orxout() << "The object should be rolled soon." << endl; 77 this->lockRotation_ = true; // multiple calls of this function have to be filtered out. 78 this->rotationTimer_.setTimer(0.1f, false, createExecutor(createFunctor(&TetrisStone::unlockRotation, this))); 79 Quaternion q(Degree(90), Vector3::UNIT_Z); 80 this->setOrientation(this->getOrientation()*q); //rotation: roll 90° 81 69 82 } 70 83 } -
code/branches/pCuts/src/modules/tetris/TetrisStone.h
r8706 r9081 38 38 #include "tetris/TetrisPrereqs.h" 39 39 40 #include "worldentities/ ControllableEntity.h"40 #include "worldentities/pawns/Pawn.h" 41 41 #include "tools/Timer.h" 42 42 … … 51 51 @ingroup Tetris 52 52 */ 53 class _TetrisExport TetrisStone : public ControllableEntity53 class _TetrisExport TetrisStone : public Pawn 54 54 { 55 55 public: … … 81 81 void enableMovement(void) 82 82 { this->delay_ = false; } 83 83 void unlockRotation(void) 84 { this->lockRotation_ = false; } 85 84 86 float size_; //!< The dimensions a stone has in the game world. 85 87 bool delay_; 88 bool lockRotation_; 86 89 Timer delayTimer_; 90 Timer rotationTimer_; 87 91 88 92 Tetris* tetris_;
Note: See TracChangeset
for help on using the changeset viewer.