Changeset 11617 for code/branches
- Timestamp:
- Dec 3, 2017, 6:02:22 PM (7 years ago)
- Location:
- code/branches/Asteroid_HS17
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/Asteroid_HS17/data/levels/Asteroids2D.oxw
r11616 r11617 17 17 include("templates/enemyInvader.oxt") 18 18 include("overlays/Asteroids2DHUD.oxo") 19 include("templates/asteroidsAsteroids2D.oxt) 19 20 ?> 20 21 -
code/branches/Asteroid_HS17/data/levels/templates/asteroidsAsteroids2D.oxt
r11614 r11617 1 <Template name = stone1> 2 <Asteroids2DStone 3 collisionType = dynamic 4 linearDamping = 0.8 5 angularDamping = 1 6 scale= 10 7 enablecollisiondamage = true 8 9 health = 10 10 maxhealth = 10 11 initialhealth = 10 12 > 13 <attached> 14 <Model mass= 4000 mesh="ast1.mesh" /> 15 </attached> 16 <collisionShapes> 17 <SphereCollisionShape radius="10" /> 18 </collisionShapes> 19 </Asteroids2DStone> 20 </Template> 21 22 <Template name = stone2> 23 <Asteroids2DStone 24 collisionType = dynamic 25 linearDamping = 0.8 26 angularDamping = 1 27 scale= 20 28 enablecollisiondamage = true 29 30 health = 10 31 maxhealth = 10 32 initialhealth = 10 33 > 34 <attached> 35 <Model mass= 8000 mesh="ast2.mesh" /> 36 </attached> 37 <collisionShapes> 38 <SphereCollisionShape radius="20" /> 39 </collisionShapes> 40 </Asteroids2DStone> 41 </Template> 42 43 <Template name = stone3> 44 <Asteroids2DStone 45 collisionType = dynamic 46 linearDamping = 0.8 47 angularDamping = 1 48 scale= 30 49 enablecollisiondamage = true 50 51 health = 10 52 maxhealth = 10 53 initialhealth = 10 54 > 55 <attached> 56 <Model mass= 16000 mesh="ast3.mesh" /> 57 </attached> 58 <collisionShapes> 59 <SphereCollisionShape radius="30" /> 60 </collisionShapes> 61 </Asteroids2DStone> 62 </Template> -
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2D.cc
r11616 r11617 26 26 * 27 27 */ 28 29 /*TODO: Punktesystem aufbauen -> in HUD anzeigen 30 Schwierigkeitsgrad mit jedem levelup erhöhen -> mehr Steine spawnen? 31 spawnStone Methode schreiben 32 templates für die drei Grössen von Asteroiden erstellen 28 33 29 34 /** … … 57 62 this->center_ = nullptr; 58 63 this->setHUDTemplate("Asteroids2DHUD"); 64 levelupTimer.setTimer(100.0f, true, createExecutor(createFunctor(&Asteroids2D::levelUp, this))); 59 65 } 60 66 … … 82 88 toggleShowLevel(); 83 89 showLevelTimer.setTimer(1.0f, false, createExecutor(createFunctor(&Asteroids2D::toggleShowLevel, this))); 90 //Nach jedem Level Up werden mehr Steine gespawnt -> abhängig vom Schwierigkeitsgrad 91 for(int i = 0; i < level*2; i++){ 92 spawnStone(); 93 } 94 84 95 } 85 96 86 97 void Asteroids2D::tick(float dt) 87 98 { 88 //Do this only for the first tick, generate stones99 //Do this only for the first tick, generate 5 stones for the beginning 89 100 if(this->firstTick_) 90 101 { … … 105 116 Asteroids2DStone* newStone = new Asteroids2DStone(this->center_->getContext()); 106 117 newStone->setAsteroids2DPlayer(player); 107 //addtemplate 118 119 switch(newStone->getSize()){ 120 case 1: 121 newStone->addTemplate("stone1"); 122 break; 123 case 2: 124 newStone->addTemplate("stone2"); 125 break; 126 case 3: 127 newStone->addTemplate("stone3"); 128 break; 129 default: 130 orxout(internal_error) << "Asteroids2DStone has invalid size and cannot be created" << endl; 131 break; 132 133 } 134 108 135 109 136 } … … 123 150 void Asteroids2D::costLife() 124 151 { 125 //endGameTimer.setTimer(8.0f, false, createExecutor(createFunctor(&Asteroids2D::end, this))); 126 lives = 0; 152 --lives; 153 if(live <= 0){ 154 endGameTimer.setTimer(8.0f, false, createExecutor(createFunctor(&Asteroids2D::end, this))); 155 } 127 156 }; 157 128 158 129 159 void Asteroids2D::start() … … 152 182 } 153 183 184 //wird gerufen, falls man einen Asteroiden trifft->Aufruf durch Schiffklasse 154 185 void Asteroids2D::addPoints(int numPoints) 155 186 { -
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2D.h
r11616 r11617 26 26 * 27 27 */ 28 29 28 30 29 31 /** … … 109 111 bool b_combo, firstTick_; 110 112 111 Timer enemySpawnTimer;112 113 Timer comboTimer; 113 114 Timer showLevelTimer; 115 Timer levelupTimer; 116 Timer endGameTimer; 114 117 115 116 /*117 118 //void spawnEnemy();119 120 121 122 123 124 125 126 127 128 129 130 131 private:132 133 134 135 136 //Context* context;137 */138 118 }; 139 119 } -
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DShip.cc
r11613 r11617 27 27 */ 28 28 29 /*TODO: orientation/direction of the ship must be defined 30 implement shoot function ->or switch it on? 31 switch off boosting particles in the back of the ship 32 29 33 /** 30 34 @file Asteroids2DShip.cc … … 49 53 this->height = 646; 50 54 51 // not sure if has to be zero?52 lastTimeFront = 0;53 lastTimeLeft = 0;54 lastTime = 0;55 55 timer.setTimer(3.5f, true, createExecutor(createFunctor(&Asteroids2DShip::showposition, this))); 56 56 } … … 85 85 void Asteroids2DShip::updateLevel() 86 86 { 87 lastTime = 0;88 87 if (getGame()) 89 88 getGame()->levelUp(); -
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DShip.h
r11614 r11617 87 87 WeakPtr<Asteroids2D> game; 88 88 WeakPtr<WorldEntity> lastEntity; 89 float lastTimeFront, lastTimeLeft, lastTime;90 89 struct Velocity 91 90 {
Note: See TracChangeset
for help on using the changeset viewer.