- Timestamp:
- Dec 3, 2017, 9:22:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.cc
r11600 r11620 33 33 34 34 #include "FlappyOrxShip.h" 35 36 35 #include "core/CoreIncludes.h" 37 36 #include "core/XMLPort.h" 38 #include "FlappyOrx.h"39 37 #include "graphics/Camera.h" 40 #include " weapons/projectiles/Projectile.h"38 #include "graphics/ParticleSpawner.h" 41 39 #include <math.h> 42 40 #include <ctime> … … 50 48 RegisterObject(FlappyOrxShip); 51 49 52 this->UpwardThrust = 1; 53 this->speed = 1; 54 this->gravity = 1; 50 55 51 isDead = true; 56 52 deathTime = 0; 53 54 particleLifespan = 0.1; 55 particleAge = 0; 56 57 particlespawner_ = NULL; 57 58 58 59 } 59 60 60 61 void FlappyOrxShip::XMLPort(Element& xmlelement, XMLPort::Mode mode) 61 { 62 SUPER(FlappyOrxShip, XMLPort, xmlelement, mode); 63 XMLPortParam(FlappyOrxShip, "Speed", setSpeed, getSpeed, xmlelement, mode); 64 XMLPortParam(FlappyOrxShip, "UpwardThrust", setUpwardThrust, getUpwardThrust, xmlelement, mode); 65 XMLPortParam(FlappyOrxShip, "Gravity", setGravity, getGravity, xmlelement, mode); 62 { 63 SUPER(FlappyOrxShip, XMLPort, xmlelement, mode); 64 XMLPortParam(FlappyOrxShip,"speedBase", setSpeedBase, getSpeedBase, xmlelement,mode); 65 XMLPortParam(FlappyOrxShip,"speedIncrease", setSpeedIncrease, getSpeedIncrease, xmlelement,mode); 66 XMLPortParam(FlappyOrxShip,"tubeDistanceBase", setTubeDistanceBase, getTubeDistanceBase, xmlelement,mode); 67 XMLPortParam(FlappyOrxShip,"tubeDistanceIncrease", setTubeDistanceIncrease, getTubeDistanceIncrease, xmlelement,mode); 68 69 XMLPortParam(FlappyOrxShip,"upwardThrust", setUpwardthrust, getUpwardthrust, xmlelement,mode); 70 XMLPortParam(FlappyOrxShip,"gravity", setGravity, getGravity, xmlelement,mode); 66 71 } 67 72 … … 69 74 { 70 75 SUPER(FlappyOrxShip, tick, dt); 76 77 78 particleAge+=dt; 79 //the particle spawner that generates the fire from the backpack when pressed 80 if (particlespawner_ == NULL) { 81 for (WorldEntity* object : this->getAttachedObjects()) 82 { 83 if (object->isA(Class(ParticleSpawner))) 84 particlespawner_ = (ParticleSpawner*) object; 85 } 86 } 87 else if(particleAge>particleLifespan){ 88 particlespawner_->setLifetime(1); 89 } 90 91 71 92 //Execute movement 72 93 if (this->hasLocalController()) … … 87 108 isFlapping = false; 88 109 if(pos.z > -150) 89 velocity.y = - UpwardThrust;110 velocity.y = -upwardThrust; 90 111 } 91 112 … … 122 143 void FlappyOrxShip::boost(bool boost){ 123 144 145 if(not isDead){ 146 particleAge = 0; 147 } 124 148 125 149 if(isDead&&timeUntilRespawn()<=0){
Note: See TracChangeset
for help on using the changeset viewer.