Changeset 10032 for code/branches/pickupsFS14/src/modules/jump/JumpShip.cc
- Timestamp:
- Apr 11, 2014, 12:07:05 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickupsFS14/src/modules/jump/JumpShip.cc
r10022 r10032 53 53 upPressed = false; 54 54 downPressed = false; 55 56 yScreenPosition = 0;57 55 yVelocity = 0; 58 56 } … … 60 58 void JumpShip::tick(float dt) 61 59 { 60 61 62 62 Vector3 movement(0,0,0); 63 63 Vector3 shipPosition = getPosition(); 64 65 /*66 //Movement calculation67 lastTimeFront += dt * damping;68 lastTimeLeft += dt * damping;69 lastTime += dt;70 71 velocity.x = interpolate(clamp(lastTimeLeft, 0.0f, 1.0f), desiredVelocity.x, 0.0f);72 velocity.y = interpolate(clamp(lastTimeFront, 0.0f, 1.0f), desiredVelocity.y, 0.0f);73 74 //Execute movement75 if (this->hasLocalController())76 {77 float dist_y = velocity.y * dt;78 float dist_x = velocity.x * dt;79 if(dist_y + posforeward > -42*3 && dist_y + posforeward < 42*6)80 posforeward += dist_y;81 else82 {83 velocity.y = 0;84 // restart if game ended85 if (getGame())86 if (getGame()->bEndGame)87 {88 getGame()->start();89 return;90 }91 }92 if (pos.z + dist_x > 42*2.5 || pos.z + dist_x < -42*3)93 velocity.x = 0;94 pos += Vector3(1000 + velocity.y, 0, velocity.x) * dt;95 96 }97 98 // shoot!99 if (isFireing)100 ControllableEntity::fire(0);101 */102 // Camera103 104 105 106 107 /*108 // bring back on track!109 if(pos.y != 0)110 pos.y = 0;111 112 setPosition(pos);113 setOrientation(Vector3::UNIT_Y, Degree(270));114 115 // Level up!116 if (pos.x > 42000)117 {118 updateLevel();119 setPosition(Vector3(0, 0, pos.z)); // pos - Vector3(30000, 0, 0)120 }121 */122 64 123 65 // Berechne Bewegung anhand der Eingabe … … 141 83 else if (downPressed == true) 142 84 { 143 platform = new JumpPlatform(getContext());144 platform->setPosition(Vector3(0, 0, 0));145 platform->setVelocity(Vector3(0, 0, 0));146 platform->setScale(100);147 148 85 movement -= Vector3(0, 0, 0); 149 86 downPressed = false; … … 162 99 setPosition(shipPosition); 163 100 164 // Bildschirmposition kann nur nach oben verschoben werden 165 if (shipPosition.y > yScreenPosition) 166 { 167 yScreenPosition = shipPosition.y; 168 } 169 170 // Kameraposition nachfuehren 171 if (camera == NULL) 172 { 173 camera = getCamera(); 174 } 175 if (camera != NULL) 176 { 177 178 camera->setPosition(Vector3(-shipPosition.x, yScreenPosition-shipPosition.y, 100)); 179 //camera->setOrientation(Vector3::UNIT_Z, Degree(180)); 180 } 181 182 SUPER(JumpShip, tick, dt); 101 SUPER(JumpShip, tick, dt); 183 102 } 184 103 /*
Note: See TracChangeset
for help on using the changeset viewer.