Changeset 9081 for code/branches/pCuts/src/modules/tetris/TetrisStone.cc
- Timestamp:
- Apr 5, 2012, 11:12:08 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.