- Timestamp:
- Apr 3, 2014, 2:57:05 PM (11 years ago)
- Location:
- code/branches/turretFS14/src/modules/objects/controllers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/turretFS14/src/modules/objects/controllers/TurretController.cc
r10008 r10018 36 36 { 37 37 RegisterObject(TurretController); 38 counter = 0; 39 flag = false; 38 40 } 39 41 … … 45 47 void TurretController::tick(float dt) 46 48 { 47 this->getControllableEntity()->rotateYaw(10*dt); 49 counter += dt; 50 if(counter >= 10) 51 { 52 counter = 0; 53 flag = !flag; 54 orxout() << "Direction change" << endl; 55 } 56 if(flag) 57 { 58 this->getControllableEntity()->rotatePitch(10*dt); 59 //this->getControllableEntity()->rotateYaw(10*dt); 60 } 61 else 62 { 63 this->getControllableEntity()->rotatePitch(-10*dt); 64 //this->getControllableEntity()->rotateYaw(-10*dt); 65 } 48 66 } 49 67 } -
code/branches/turretFS14/src/modules/objects/controllers/TurretController.h
r10008 r10018 42 42 43 43 virtual void tick(float dt); 44 45 private: 46 float counter; 47 bool flag; 44 48 }; 45 49 }
Note: See TracChangeset
for help on using the changeset viewer.