Changeset 10306 in orxonox.OLD for branches/playability/src
- Timestamp:
- Jan 23, 2007, 9:32:51 PM (18 years ago)
- Location:
- branches/playability/src/world_entities/space_ships
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/space_ships/space_ship.cc
r10303 r10306 371 371 this->travelDistancePlus = Vector2D(0,0); 372 372 this->isTravelDistanceInit = false; 373 this->actionWidthPercentage = 0.7;373 this->actionWidthPercentage = 1; 374 374 375 375 this->cameraSpeed = 40; … … 579 579 { 580 580 this->updateTravelDistance(); 581 this->isTravelDistanceInit = true;581 //this->isTravelDistanceInit = true; 582 582 } 583 583 … … 1142 1142 void SpaceShip::updateTravelDistance() 1143 1143 { 1144 float x = 1.25 *fabsf(State::getCamera()->getAbsCoor().y) * tan(State::getCamera()->getFovy()*M_PI /360.0);1145 float y = x / State::getCamera()->getAspectRatio() ;1144 float x = 1.25 * this->actionWidthPercentage * fabsf(State::getCamera()->getAbsCoor().y) * tan(State::getCamera()->getFovy()*M_PI /360.0); 1145 float y = x / State::getCamera()->getAspectRatio() / this->actionWidthPercentage; 1146 1146 //State::getCamera()->setAbsCoor(-5, 1000, 0); 1147 1147 1148 1148 1149 1149 //State::getCamera()->getAbsCoor().print(); 1150 printf("CameraRelCoorY: %f \n", State::getCamera()->getRelCoor().y);1151 1152 printf("x: %f, y: %f \n", x, y);1150 //printf("CameraRelCoorY: %f \n", State::getCamera()->getRelCoor().y); 1151 1152 //printf("x: %f, y: %f \n", x, y); 1153 1153 this->travelDistancePlus = Vector2D(y, x); 1154 1154 this->travelDistanceMinus = Vector2D(-y, -x); 1155 1155 1156 //this->isTravelDistanceInit = true; 1157 } 1156 State::getPlayer()->hud().setOverlayPercentage(100-int(100*this->actionWidthPercentage)); 1157 PRINTF(0)("TravelDistance has been updated\n"); 1158 this->isTravelDistanceInit = true; 1159 } 1160 1161 void SpaceShip::setActionWidthPercentage(int i) 1162 { 1163 if (i>100) i=100; 1164 if (i<0) i=0; 1165 this->actionWidthPercentage = i/100.0; 1166 //State::getPlayer()->hud().setOverlayPercentage(100-i); 1167 //updateTravelDistance(); 1168 this->isTravelDistanceInit = false; 1169 }; -
branches/playability/src/world_entities/space_ships/space_ship.h
r10291 r10306 81 81 virtual void enterPlaymode(Playable::Playmode playmode); 82 82 void setPlaymodeXML(const std::string& playmode); //recieves the playmode from a string (useful for script implementation) 83 inline void setActionWidthPercentage(float f) {this->actionWidthPercentage = f; updateTravelDistance();};83 void setActionWidthPercentage(int i); 84 84 void updateTravelDistance(); 85 85 virtual void movement (float dt);
Note: See TracChangeset
for help on using the changeset viewer.