Changeset 11514 for code/branches/FlappyOrx_HS17/src/modules
- Timestamp:
- Oct 30, 2017, 2:33:33 PM (7 years ago)
- Location:
- code/branches/FlappyOrx_HS17/src/modules/flappyorx
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.cc
r11505 r11514 101 101 if (player == nullptr) 102 102 { 103 for (FlappyOrxShip* ship : ObjectList<FlappyOrxShip>()) 103 for (FlappyOrxShip* ship : ObjectList<FlappyOrxShip>()) { 104 104 player = ship; 105 } 105 106 } 106 107 return player; -
code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.cc
r11509 r11514 49 49 RegisterObject(FlappyOrxShip); 50 50 51 UpwardThrust = 250; 52 speed = 50; 53 gravity = 20; 54 void AutonomousDrone::XMLPort(Element& xmlelement, XMLPort::Mode mode) 51 this->UpwardThrust = 1; 52 this->speed = 1;orxout() << "constr speed set: " << 1 << endl; 53 this->gravity = 1; 54 55 } 56 void FlappyOrxShip::XMLPort(Element& xmlelement, XMLPort::Mode mode) 55 57 { 56 SUPER( AutonomousDrone, XMLPort, xmlelement, mode);58 SUPER(FlappyOrxShip, XMLPort, xmlelement, mode); 57 59 XMLPortParam(FlappyOrxShip, "speed", setSpeed, getSpeed, xmlelement, mode); 58 60 XMLPortParam(FlappyOrxShip, "UpwardThrust", setUpwardThrust, getUpwardThrust, xmlelement, mode); 59 61 XMLPortParam(FlappyOrxShip, "gravity", setGravity, getGravity, xmlelement, mode); 60 }61 62 } 63 62 64 void FlappyOrxShip::tick(float dt) 63 { //Execute movement 65 { 66 SUPER(FlappyOrxShip, tick, dt); 67 //Execute movement 64 68 if (this->hasLocalController()) 65 69 { … … 72 76 } 73 77 74 75 78 pos += Vector3(speed + velocity.x, 0, velocity.y) * dt; 76 79 … … 100 103 101 104 } 102 103 104 SUPER(FlappyOrxShip, tick, dt);105 105 } 106 106 -
code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.h
r11511 r11514 62 62 virtual void rotateRoll(const Vector2& value) override; 63 63 inline void setSpeed( float speed ) 64 { this->speed = speed; }65 inline voidgetSpeed( )64 { orxout() << "speed set: " << speed << endl; this->speed = speed; } 65 inline float getSpeed( ) 66 66 { return this->speed; } 67 67 inline void setGravity( float gravity ) 68 68 { this->gravity = gravity; } 69 inline voidgetGravity()69 inline float getGravity() 70 70 { return this->gravity; } 71 inline void set Speed( float UpwardThrust )71 inline void setUpwardThrust( float UpwardThrust ) 72 72 { this->UpwardThrust = UpwardThrust; } 73 inline void getSpeed()73 inline float getUpwardThrust() 74 74 { return this->UpwardThrust; } 75 75 virtual void updateLevel(); 76 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 76 77 77 78 protected:
Note: See TracChangeset
for help on using the changeset viewer.