Changeset 10032 for code/branches/pickupsFS14
- Timestamp:
- Apr 11, 2014, 12:07:05 PM (11 years ago)
- Location:
- code/branches/pickupsFS14
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickupsFS14/data/levels/Jump.oxw
r10017 r10032 56 56 </Planet> 57 57 58 <MovableEntity 59 position="0, 0, 500" 60 scale="5" 61 collisionType="dynamic" 62 mass="10000000" 63 > 64 <attached> 65 <Model mesh="Platform01.mesh" /> 66 </attached> 67 </MovableEntity> 68 58 69 59 70 … … 64 75 65 76 <SpawnPoint team=0 position="0,0,0" lookat="0,0,-1" spawnclass=JumpShip pawndesign=spaceshipjump /> 66 67 68 77 69 78 -
code/branches/pickupsFS14/src/modules/jump/Jump.cc
r10022 r10032 60 60 { 61 61 RegisterObject(Jump); 62 platformList.clear(); 63 yScreenPosition = 0; 64 screenShiftSinceLastUpdate = 0; 65 62 66 //this->numberOfBots_ = 0; //sets number of default bots temporarly to 0 63 67 //this->center_ = 0; 64 // init();65 68 //this->setHUDTemplate("JumpHUD"); 66 69 67 } 68 69 void Jump::init() 70 { 71 /*bEndGame = false; 72 lives = 3; 73 level = 1; 74 point = 0; 75 bShowLevel = false; 76 multiplier = 1; 77 b_combo = false;*/ 78 // spawn enemy every 3.5 seconds 79 //enemySpawnTimer.setTimer(3.5f, true, createExecutor(createFunctor(&Jump::spawnEnemy, this))); 80 //comboTimer.setTimer(3.0f, true, createExecutor(createFunctor(&Jump::comboControll, this))); 81 } 70 71 } 72 82 73 83 74 /*void Jump::levelUp() … … 104 95 if (player == NULL) 105 96 { 106 ObjectList<JumpShip>::iterator it; 107 it = ObjectList<JumpShip>::begin(); 108 /*for (ObjectList<JumpShip>::iterator it = ObjectList<JumpShip>::begin(); it != ObjectList<JumpShip>::end(); ++it) 97 for (ObjectList<JumpShip>::iterator it = ObjectList<JumpShip>::begin(); it != ObjectList<JumpShip>::end(); ++it) 109 98 { 110 99 player = *it; 111 } */100 } 112 101 } 113 102 return player; 114 103 } 104 105 void Jump::tick(float dt) 106 { 107 108 109 if (getPlayer() != NULL) 110 { 111 Vector3 shipPosition = getPlayer()->getPosition(); 112 113 // Bildschirmposition kann nur nach oben verschoben werden 114 if (shipPosition.y > yScreenPosition) 115 { 116 screenShiftSinceLastUpdate += shipPosition.y - yScreenPosition; 117 118 yScreenPosition = shipPosition.y; 119 } 120 121 // Kameraposition nachfuehren 122 if (camera == NULL) 123 { 124 camera = getPlayer()->getCamera(); 125 } 126 if (camera != NULL) 127 { 128 camera->setPosition(Vector3(-shipPosition.x, yScreenPosition-shipPosition.y, 100)); 129 //camera->setOrientation(Vector3::UNIT_Z, Degree(180)); 130 } 131 132 if (screenShiftSinceLastUpdate > 200.0) 133 { 134 screenShiftSinceLastUpdate -= 200.0; 135 orxout() << "new section added" << endl; 136 addPlatform(shipPosition.x, shipPosition.y + 300.0); 137 } 138 139 } 140 141 SUPER(Jump, tick, dt); 142 } 143 115 144 116 145 /*void Jump::spawnEnemy() … … 158 187 }*/ 159 188 160 /*void Jump::start() 161 { 162 init(); 189 190 void Jump::start() 191 { 192 // Call start for the parent class. 193 Deathmatch::start(); 194 195 /* 163 196 // Set variable to temporarily force the player to spawn. 164 197 this->bForceSpawn_ = true; … … 170 203 return; 171 204 } 172 // Call start for the parent class. 173 Deathmatch::start(); 174 }*/ 205 */ 206 207 //addPlatform(0,0); 208 209 } 210 175 211 176 212 /*void Jump::addPoints(int numPoints) … … 191 227 GSLevel::startMainMenu(); 192 228 }*/ 229 230 void Jump::addPlatform(float xPosition, float yPosition) 231 { 232 JumpPlatform* newPlatform = new JumpPlatform(center_->getContext()); 233 newPlatform->setPosition(Vector3(xPosition, yPosition, 0)); 234 platformList.push_front(newPlatform); 235 } 236 193 237 } -
code/branches/pickupsFS14/src/modules/jump/Jump.h
r10022 r10032 41 41 #include "tools/Timer.h" 42 42 #include "JumpPlatform.h" 43 #include <list> 44 43 45 44 46 namespace orxonox … … 49 51 public: 50 52 Jump(Context* context); 51 52 //virtual void start(); 53 virtual void start(); 53 54 //virtual void end(); 54 55 //virtual void addBots(unsigned int amount){} //<! overwrite function in order to bypass the addbots command 56 57 virtual void tick(float dt); 55 58 56 59 //void spawnEnemy(); 57 60 58 61 void setCenterpoint(JumpCenterPoint* center){ this->center_ = center; } 62 63 virtual void addPlatform(float x, float y); 59 64 60 65 /*int getLives(){return this->lives;} … … 68 73 // checks if multiplier should be reset. 69 74 void comboControll();*/ 70 void init();71 75 //int lives; 72 76 //int multiplier; … … 78 82 WeakPtr<JumpCenterPoint> center_; 79 83 WeakPtr<JumpShip> player; 84 WeakPtr<Camera> camera; 80 85 81 86 /*Timer enemySpawnTimer; … … 86 91 int point; 87 92 bool b_combo;*/ 93 std::list<JumpPlatform*> platformList; 94 float yScreenPosition; 95 float screenShiftSinceLastUpdate; 88 96 }; 89 97 } -
code/branches/pickupsFS14/src/modules/jump/JumpPlatform.cc
r10022 r10032 51 51 model = new Model(getContext()); 52 52 model->setSyncMode(0); 53 model->setMeshSource(" drone.mesh");53 model->setMeshSource("Platform01.mesh"); 54 54 55 movableEntity = new MovableEntity(getContext()); 56 movableEntity->attach(model); 57 58 movableEntity->setScale(100); 59 //movableEntity->setPosition(Vector3(0,0,0)); 60 //movableEntity->setVelocity(Vector3(0,0,1)); 61 55 attach(model); 56 setScale(5); 57 setPosition(Vector3(0,0,0)); 58 setVelocity(Vector3(0,0,0)); 62 59 63 60 } 64 61 62 void JumpPlatform::tick(float dt) 63 { 64 //setAngularVelocity(getAngularVelocity() + Vector3(0.05,0,0)); 65 /*Vector3 movement(0,0,0); 66 Vector3 shipPosition = getPosition();*/ 65 67 66 68 67 69 70 SUPER(JumpPlatform, tick, dt); 71 } 72 73 68 74 } -
code/branches/pickupsFS14/src/modules/jump/JumpPlatform.h
r10022 r10032 45 45 public: 46 46 JumpPlatform(Context* context); 47 47 virtual void tick(float dt); 48 48 49 49 private: 50 50 Model* model; 51 MovableEntity* movableEntity;52 53 51 }; 54 52 } -
code/branches/pickupsFS14/src/modules/jump/JumpPrereqs.h
r10005 r10032 71 71 class JumpCenterPoint; 72 72 class JumpShip; 73 class JumpPlatform; 73 74 class JumpEnemy; 74 75 class JumpEnemyShooter; -
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 /* -
code/branches/pickupsFS14/src/modules/jump/JumpShip.h
r10022 r10032 73 73 WeakPtr<Jump> getGame(); 74 74 WeakPtr<Jump> game; 75 WeakPtr<Camera> camera;76 75 const float xVelocity = 150.0f; 77 76 const float xBoundary = 200.0f; … … 100 99 bool downPressed; 101 100 102 float yScreenPosition;103 101 float yVelocity; 104 102 const float yAcceleration = 10.0f; 105 103 const float ySpeedAfterJump = 300.0f; 106 107 JumpPlatform* platform;108 104 }; 109 105 }
Note: See TracChangeset
for help on using the changeset viewer.