Changeset 10135 for code/branches/surfaceraceHS14/src
- Timestamp:
- Nov 26, 2014, 3:59:37 PM (10 years ago)
- Location:
- code/branches/surfaceraceHS14/src/modules/dodgerace2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRace.cc
r10124 r10135 58 58 multiplier = 1; 59 59 b_combo = false; 60 60 counter = 0; 61 lastPosition = 0; 61 62 // spawn enemy every 3.5 seconds 62 63 //enemySpawnTimer.setTimer(3.5f, true, createExecutor(createFunctor(&DodgeRace::spawnEnemy, this))); … … 81 82 toggleShowLevel(); 82 83 showLevelTimer.setTimer(1.0f, false, createExecutor(createFunctor(&DodgeRace::toggleShowLevel, this))); 84 } 85 86 void DodgeRace::tick(float dt) 87 { 88 if (getPlayer() != NULL) 89 { 90 //WeakPtr<DodgeRaceShip> ship = getPlayer(); 91 92 currentPosition = getPlayer()->getWorldPosition().x; 93 counter = counter + (currentPosition - lastPosition); 94 lastPosition = currentPosition; 95 96 if(counter >= 5000) 97 { 98 counter = 0; 99 100 WeakPtr<StaticEntity> stentity = new StaticEntity(this->center_->getContext()); //this->center_->getContext() 101 stentity->addTemplate("DodgeRaceCube01"); 102 103 stentity->setPosition(getPlayer()->getWorldPosition() + Vector3(5000, 0, 0)); 104 //stentity->setScale3D(50,50,50); 105 } 106 } 107 SUPER(DodgeRace, tick, dt); 83 108 } 84 109 -
code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRace.h
r10124 r10135 74 74 virtual void end(); 75 75 76 virtual void tick(float dt); 77 76 78 void levelUp(); 77 79 … … 93 95 int lives; 94 96 int multiplier; 97 int counter; 98 int currentPosition; 99 int lastPosition; 95 100 96 101 private: -
code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRaceShip.cc
r10128 r10135 42 42 RegisterObject(DodgeRaceShip); 43 43 44 speed = 500;44 speed = 800; 45 45 isFireing = false; 46 46 damping = 10; … … 82 82 } 83 83 } 84 /* 84 85 if (pos.z + dist_x > 42*2.5 || pos.z + dist_x < -42*3) 85 velocity.x = 0; 86 { 87 velocity.x = 0; 88 } 89 */ 86 90 pos += Vector3(1000 + velocity.y, 0, velocity.x) * dt; 87 91 } … … 99 103 if (camera != NULL) 100 104 { 101 camera->setPosition(Vector3(-pos.z, -posforeward, 0));105 // camera->setPosition(Vector3(-pos.z, -posforeward, 0)); 102 106 camera->setOrientation(Vector3::UNIT_Z, Degree(0)); 103 107 } … … 145 149 void DodgeRaceShip::boost(bool bBoost) 146 150 { 147 isFireing = bBoost;151 //isFireing = bBoost; 148 152 } 149 153 150 154 inline bool DodgeRaceShip::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 151 155 { 156 /* 152 157 if (otherObject != NULL && lastEntity != otherObject) 153 158 { 154 159 lastEntity = otherObject; 155 160 removeHealth(20); 156 //this->death();157 161 } 162 */ 158 163 164 165 this->death(); 159 166 return false; 160 167 }
Note: See TracChangeset
for help on using the changeset viewer.