Changeset 11613 for code/branches/Asteroid_HS17/src/modules
- Timestamp:
- Nov 30, 2017, 6:34:56 PM (7 years ago)
- Location:
- code/branches/Asteroid_HS17/src/modules/asteroids2D
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2D.cc
r11608 r11613 55 55 pattern = 1; 56 56 lastPosition = 0; 57 // spawn enemy every 3.5 seconds58 //enemySpawnTimer.setTimer(3.5f, true, createExecutor(createFunctor(&Asteroids2D::spawnEnemy, this)));59 57 this->numberOfBots_ = 0; //sets number of default bots temporarly to 0 60 58 this->center_ = nullptr; 61 59 this->setHUDTemplate("Asteroids2DHUD"); 62 60 } 61 62 63 63 64 64 void Asteroids2D::levelUp() -
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2D.h
r11608 r11613 89 89 void costLife(); 90 90 91 91 92 bool bEndGame; 92 93 bool bShowLevel; -
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DCenterPoint.cc
r11608 r11613 48 48 49 49 this->checkGametype(); 50 this->width_ = 200;51 this->height_ = 120;50 this->width_ = 1043; 51 this->height_ = 646; 52 52 } 53 53 /** -
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DShip.cc
r11608 r11613 46 46 isFireing = false; 47 47 damping = 10; 48 this->width = 1043; 49 this->height = 646; 48 50 49 51 // not sure if has to be zero? … … 51 53 lastTimeLeft = 0; 52 54 lastTime = 0; 55 timer.setTimer(3.5f, true, createExecutor(createFunctor(&Asteroids2DShip::showposition, this))); 56 } 57 58 //Use this function to display your position on the field -> to determine field width and height 59 void Asteroids2DShip::showposition() 60 { 61 Vector3 pos = this->getPosition(); 62 orxout() << "x = "<< pos.x << " y = " << pos.y << " z = "<< pos.z << endl; 53 63 } 54 64 … … 56 66 { 57 67 SUPER(Asteroids2DShip, tick, dt); 68 Vector3 pos = this->getPosition(); 69 70 //haelt ship innerhalb des Kamerafensters, kommt oben bzw seitlich wieder raus. Man spawnt in (0,0) 71 if(pos.x > width/2) pos.x = -width/2; 72 if(pos.x < -width/2) pos.x = width/2; 73 if(pos.z > height/2) pos.z = -height/2; 74 if(pos.z < -height/2) pos.z = height/2; 75 76 //2D movement, position should always = 0 on y-axis 77 if(pos.y!=0) pos.y = 0; 78 this->setPosition(pos); 79 80 //update level 81 82 //shoot? 58 83 } 59 84 -
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DShip.h
r11608 r11613 45 45 //#include "Asteroids2DCenterPoint.h" 46 46 47 #include "tools/Timer.h" 48 49 47 50 namespace orxonox 48 51 { … … 61 64 virtual void boost(bool bBoost) override; 62 65 63 //no rotation! 64 virtual void rotateYaw(const Vector2& value) override{}; 65 virtual void rotatePitch(const Vector2& value) override{}; 66 //no rotation in x and z direction! 67 virtual void rotateYaw(const Vector2& value) override{}; // Rotate in yaw direction. 68 virtual void rotatePitch(const Vector2& value) override{}; // Rotate in pitch direction. 69 virtual void rotateRoll(const Vector2& value) override{}; // Rotate in roll direction. 66 70 67 //return to main menu if game has ended. 68 virtual void rotateRoll(const Vector2& value) override{if (getGame()) if (getGame()->bEndGame) getGame()->end();}; 71 69 72 70 73 virtual void updateLevel(); … … 74 77 float speed, damping, posforeward; 75 78 bool isFireing; 79 void showposition(); 76 80 77 81 protected: … … 80 84 private: 81 85 Asteroids2D* getGame(); 86 float width, height; 82 87 WeakPtr<Asteroids2D> game; 83 88 WeakPtr<WorldEntity> lastEntity; … … 89 94 } velocity, desiredVelocity; 90 95 96 Timer timer; 91 97 }; 92 98 }
Note: See TracChangeset
for help on using the changeset viewer.