- Timestamp:
- Feb 18, 2018, 12:50:22 AM (7 years ago)
- File:
-
- 1 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 }
Note: See TracChangeset
for help on using the changeset viewer.