Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 23, 2007, 9:32:51 PM (17 years ago)
Author:
muellmic
Message:

the percentage of the width of the screen, that the player can use for his movement can now correctly been handled by the spaceship, also within the script. the value is called 'actionWidthPercentage' btw. (yeah i know the name is horrible ). anyway it also changes the width of the hud-sidebars. its still a bit buggy tough, how it places the hud-elements with a too-small sidebar. i have to find a new solution for this.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/playability/src/world_entities/space_ships/space_ship.cc

    r10303 r10306  
    371371  this->travelDistancePlus = Vector2D(0,0);
    372372  this->isTravelDistanceInit = false;
    373   this->actionWidthPercentage = 0.7;
     373  this->actionWidthPercentage = 1;
    374374
    375375  this->cameraSpeed = 40;
     
    579579  {
    580580    this->updateTravelDistance();
    581     this->isTravelDistanceInit = true;
     581    //this->isTravelDistanceInit = true;
    582582  }
    583583
     
    11421142void SpaceShip::updateTravelDistance()
    11431143{
    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;
    11461146  //State::getCamera()->setAbsCoor(-5, 1000, 0);
    11471147
    11481148
    11491149  //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);
    11531153  this->travelDistancePlus = Vector2D(y, x);
    11541154  this->travelDistanceMinus = Vector2D(-y, -x);
    11551155
    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
     1161void 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};
Note: See TracChangeset for help on using the changeset viewer.