Changeset 11543 for code/branches/FlappyOrx_HS17/src/modules/flappyorx
- Timestamp:
- Nov 6, 2017, 4:18:11 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.cc
r11537 r11543 69 69 { 70 70 if(getHealth()<0){ 71 getGame()->costLife();72 73 death();71 setHealth(1); 72 getGame()->death(); 73 death(); 74 74 } 75 75 Vector3 pos = getPosition(); … … 87 87 pos += Vector3(speed + velocity.x, 0, velocity.y) * dt; 88 88 89 if(pos.z > 150){ 90 pos.z=0; 91 velocity.y = 0; 92 } 93 94 // restart if game ended 95 if (getGame()) 96 if (getGame()->bEndGame) 97 { 98 getGame()->start(); 99 return; 100 } 101 89 102 90 103 91 // Camera … … 105 93 if (camera != nullptr) 106 94 { 107 camera->setPosition(Vector3(-pos.z, -pos.y, 0)); 108 camera->setOrientation(Vector3::UNIT_Z, Degree(90)); 95 //camera->setPosition(Vector3(-pos.z, -pos.y, 0)); 96 camera->setPosition(pos.x,-100,0); 97 camera->setOrientation(Vector3::UNIT_Z, Degree(0)); 98 109 99 } 110 100 111 101 112 102 setPosition(pos); 113 setOrientation(Vector3::UNIT_Y, Degree(270)); 103 setOrientation(Vector3::UNIT_Y, Degree(270-velocity.y/10)); 104 105 if(pos.z > 150){ 106 getGame()->death(); 107 death(); 108 } 114 109 115 110 } … … 154 149 Vector3 pos = getPosition(); 155 150 pos.x = 0; 151 pos.z = 0; 152 pos.y = 0; 153 velocity.y = 0; 156 154 setPosition(pos); 155 usleep(1000u); 157 156 } 158 157 }
Note: See TracChangeset
for help on using the changeset viewer.