Changeset 11761
- Timestamp:
- Feb 18, 2018, 12:50:22 AM (7 years ago)
- Location:
- code/branches/Presentation_HS17_merge/src/modules/flappyorx
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/Presentation_HS17_merge/src/modules/flappyorx/FlappyOrxShip.cc
r11759 r11761 51 51 isFlapping = false; 52 52 isDead = true; 53 velocity = 0; 53 54 speed = 0; 54 55 upwardThrust = 0; … … 107 108 108 109 if(not isDead){ 109 velocity .y+= gravity*dt;110 velocity += gravity*dt; 110 111 if(isFlapping){ 111 112 isFlapping = false; 112 113 if(pos.z > -150) 113 velocity .y= -upwardThrust;114 velocity = -upwardThrust; 114 115 } 115 116 116 pos += Vector3(speed + velocity.x, 0, velocity.y) * dt;117 pos += Vector3(speed, 0, velocity) * dt; 117 118 } 118 119 … … 129 130 130 131 setPosition(pos); 131 setOrientation(Vector3::UNIT_Y, Degree(270-velocity .y/10));132 setOrientation(Vector3::UNIT_Y, Degree(270-velocity/10)); 132 133 133 134 if(pos.z > 150){ … … 176 177 pos.z = 0; 177 178 pos.y = 0; 178 velocity .y= 0;179 velocity = 0; 179 180 setPosition(pos); 180 181 } -
code/branches/Presentation_HS17_merge/src/modules/flappyorx/FlappyOrxShip.h
r11758 r11761 88 88 bool isFlapping; 89 89 bool isDead; 90 float velocity; 90 91 float speed, upwardThrust, gravity; 91 92 float particleAge, particleLifespan; 92 93 time_t deathTime; 93 struct Velocity94 {95 float x;96 float y;97 } velocity;98 94 99 95 };
Note: See TracChangeset
for help on using the changeset viewer.