Changeset 10017 for code/branches/pickupsFS14
- Timestamp:
- Apr 3, 2014, 2:35:54 PM (11 years ago)
- Location:
- code/branches/pickupsFS14
- Files:
-
- 3 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickupsFS14/data/levels/Jump.oxw
r10005 r10017 11 11 12 12 <?lua 13 include("templates/spaceshipAssff2.oxt")14 include("templates/spaceshipPirate.oxt")15 include("templates/spaceship Invader.oxt")16 include("templates/enemyInvader.oxt")17 include("overlays/InvaderHUD.oxo")13 -- include("templates/spaceshipAssff2.oxt") 14 -- include("templates/spaceshipPirate.oxt") 15 include("templates/spaceshipJump.oxt") 16 -- include("templates/enemyInvader.oxt") 17 -- include("overlays/InvaderHUD.oxo") 18 18 ?> 19 19 20 20 21 <Level gametype = Jump> … … 35 36 /> 36 37 38 <Planet 39 position="0, 0, -2000" 40 scale="1000" 41 collisionType="dynamic" 42 linearDamping="0.8" 43 angularDamping="0" 44 mass="10000000" 45 pitch="0" 46 mesh="planets/muunilinst.mesh" 47 atmosphere="atmosphere1" 48 rotationaxis="1,0,0" 49 rotationrate="1.0" 50 atmospheresize="80.0f" 51 imagesize="1024.0f" 52 collisiondamage = 2 53 enablecollisiondamage = true 54 > 55 56 </Planet> 57 58 37 59 38 60 <!-- <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/> --> … … 41 63 42 64 43 <SpawnPoint team=0 position=" -200,0,0" lookat="0,0,0" spawnclass=JumpShip pawndesign=spaceshipinvader/>44 <!-- 45 <DistanceTrigger name="start" position="-200,0,0" target="Pawn" distance=10 stayActive="true" delay=0 />65 <SpawnPoint team=0 position="0,0,0" lookat="0,0,-1" spawnclass=JumpShip pawndesign=spaceshipjump /> 66 67 46 68 47 69 … … 50 72 51 73 <?lua 52 for i = 1, 300, 1 do74 for i = 1, 200, 1 do 53 75 j = math.random() 54 76 ?> 55 77 56 78 <MovableEntity 57 position = "<?lua print(math.random( )* 40000 + 1000) ?>,-1000,<?lua print(math.random() * 4000 - 2000) ?>"79 position = "<?lua print(math.random(-300,300)) ?>,<?lua print(math.random(-250,10000)) ?>,-300>" 58 80 collisionType = dynamic 59 81 linearDamping = 0.8 60 82 angularDamping = 0 61 scale = " <?lua print(j * 150)?>"83 scale = "10" 62 84 collisiondamage = 0 63 enablecollisiondamage = true 85 enablecollisiondamage = no 86 64 87 > 65 88 <attached> 66 89 <Model mass="<?lua print(j * 1000) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" /> 67 90 </attached> 68 <collisionShapes> 69 <SphereCollisionShape radius="<?lua print(j * 350) ?>" /> 70 </collisionShapes> 91 71 92 </MovableEntity> 72 93 … … 75 96 ?> 76 97 77 -->98 78 99 79 100 </Scene> 80 101 </Level> 81 -
code/branches/pickupsFS14/src/Orxonox.cc
r8858 r10017 27 27 * 28 28 */ 29 30 29 31 30 32 /** -
code/branches/pickupsFS14/src/modules/jump/CMakeLists.txt
r10005 r10017 4 4 JumpCenterPoint.cc 5 5 JumpShip.cc 6 JumpPlatform.cc 6 7 END_BUILD_UNIT 7 8 ) -
code/branches/pickupsFS14/src/modules/jump/Jump.cc
r10005 r10017 46 46 #include "JumpCenterPoint.h" 47 47 #include "JumpShip.h" 48 #include "JumpPlatform.h" 48 49 /* 49 50 #include "JumpEnemy.h" -
code/branches/pickupsFS14/src/modules/jump/JumpCenterPoint.cc
r10005 r10017 70 70 } 71 71 } 72 73 72 74 } -
code/branches/pickupsFS14/src/modules/jump/JumpShip.cc
r10005 r10017 49 49 //isFireing = false; 50 50 //damping = 10; 51 left = false; 52 right = false; 53 51 leftPressed = false; 52 rightPressed = false; 53 upPressed = false; 54 downPressed = false; 55 56 yScreenPosition = 0; 57 yVelocity = 0; 54 58 } 55 59 56 60 void JumpShip::tick(float dt) 57 61 { 58 59 Vector3 pos= getPosition();62 Vector3 movement(0,0,0); 63 Vector3 shipPosition = getPosition(); 60 64 61 65 /* … … 95 99 if (isFireing) 96 100 ControllableEntity::fire(0); 97 101 */ 98 102 // Camera 99 WeakPtr<Camera> camera = this->getCamera(); 100 if (camera != NULL) 101 { 102 camera->setPosition(Vector3(-pos.z, -posforeward, 0)); 103 camera->setOrientation(Vector3::UNIT_Z, Degree(90)); 104 } 105 106 107 103 104 105 106 107 /* 108 108 // bring back on track! 109 109 if(pos.y != 0) … … 121 121 */ 122 122 123 if (left == true) 124 { 125 pos += Vector3(100 + pos.y, 0, 0) * dt; 126 left = false; 127 } 128 else if (right == true) 129 { 130 right = false; 131 } 132 133 setPosition(pos); 134 123 // Berechne Bewegung anhand der Eingabe 124 if (leftPressed == true) 125 { 126 movement -= Vector3(xVelocity, 0, 0); 127 leftPressed = false; 128 } 129 else if (rightPressed == true) 130 { 131 movement += Vector3(xVelocity, 0, 0); 132 rightPressed = false; 133 } 134 135 if (upPressed == true) 136 { 137 //movement += Vector3(0, xVelocity, 0); 138 yVelocity = ySpeedAfterJump; 139 upPressed = false; 140 } 141 else if (downPressed == true) 142 { 143 movement -= Vector3(0, 0, 0); 144 downPressed = false; 145 } 146 147 movement += Vector3(0, yVelocity, 0); 148 yVelocity -= yAcceleration; 149 150 // Skalierung der Bewegung je nach vergangener Zeit 151 movement *= dt; 152 153 // Verschiebe das Schiff um den berechneten Vektor movement und verhindere Verlassen des Bildschrims 154 shipPosition.x = clamp(shipPosition.x + movement.x, -xBoundary, xBoundary); 155 shipPosition.y += movement.y; 156 157 setPosition(shipPosition); 158 159 // Bildschirmposition kann nur nach oben verschoben werden 160 if (shipPosition.y > yScreenPosition) 161 { 162 yScreenPosition = shipPosition.y; 163 } 164 165 // Kameraposition nachfuehren 166 if (camera == NULL) 167 { 168 camera = getCamera(); 169 } 170 if (camera != NULL) 171 { 172 173 camera->setPosition(Vector3(-shipPosition.x, yScreenPosition-shipPosition.y, 100)); 174 //camera->setOrientation(Vector3::UNIT_Z, Degree(180)); 175 } 135 176 136 177 SUPER(JumpShip, tick, dt); … … 146 187 void JumpShip::moveFrontBack(const Vector2& value) 147 188 { 189 if (value.y < 0) 190 { 191 downPressed = true; 192 } 193 else if (value.y > 0) 194 { 195 upPressed = true; 196 } 148 197 //lastTimeLeft = 0; 149 198 //desiredVelocity.x = -value.x * speed; … … 152 201 void JumpShip::moveRightLeft(const Vector2& value) 153 202 { 154 if (value. y< 0)155 { 156 left = true;157 } 158 else if (value. y> 0)159 { 160 right = true;203 if (value.x < 0) 204 { 205 leftPressed = true; 206 } 207 else if (value.x > 0) 208 { 209 rightPressed = true; 161 210 } 162 211 //lastTimeFront = 0; -
code/branches/pickupsFS14/src/modules/jump/JumpShip.h
r10005 r10017 56 56 // Starts or stops fireing 57 57 virtual void boost(bool bBoost); 58 58 */ 59 59 //no rotation! 60 60 virtual void rotateYaw(const Vector2& value){}; 61 61 virtual void rotatePitch(const Vector2& value){}; 62 62 //return to main menu if game has ended. 63 virtual void rotateRoll(const Vector2& value){ if (getGame()) if (getGame()->bEndGame) getGame()->end();};63 virtual void rotateRoll(const Vector2& value){}; 64 64 65 virtual void updateLevel();65 /*virtual void updateLevel(); 66 66 67 67 virtual inline bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint); … … 72 72 WeakPtr<Jump> getGame(); 73 73 WeakPtr<Jump> game; 74 //Camera* camera; 74 WeakPtr<Camera> camera; 75 const float xVelocity = 150.0f; 76 const float xBoundary = 200.0f; 77 78 75 79 //bool isFireing; 76 80 //float speed; … … 90 94 } velocity, desiredVelocity;*/ 91 95 92 bool left; 93 bool right; 96 bool leftPressed; 97 bool rightPressed; 98 bool upPressed; 99 bool downPressed; 94 100 95 96 101 float yScreenPosition; 102 float yVelocity; 103 const float yAcceleration = 10.0f; 104 const float ySpeedAfterJump = 300.0f; 97 105 }; 98 106 }
Note: See TracChangeset
for help on using the changeset viewer.