Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9097 in orxonox.OLD for branches


Ignore:
Timestamp:
Jul 4, 2006, 3:31:30 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: TravelNode functionality (height and speed)

Location:
branches/presentation/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/presentation/src/lib/math/quaternion.h

    r9092 r9097  
    2525
    2626#include "compiler.h"
    27 //! PI the circle-constant
    28 #define PI 3.14159265359f
    2927#include "vector.h"
    3028
  • branches/presentation/src/world_entities/space_ships/spacecraft_2d.cc

    r9087 r9097  
    2525
    2626#include "util/loading/factory.h"
     27#include "util/loading/load_param.h"
    2728#include "key_mapper.h"
    2829#include "state.h"
     
    4243{
    4344  this->setPlayer(NULL);
     45  delete this->toTravelHeight;
    4446}
    4547
     
    116118
    117119  /// 2D-MODE
    118   this->travelHeight = 0.0f;
    119120  this->toTravelHeight = NULL;
    120121  this->travelSpeed = 0.0f;
     
    201202{
    202203  Playable::loadParams(root);
     204
     205  LoadParam(root, "travel-speed", this, Spacecraft2D, setTravelSpeed);
     206  LoadParam(root, "travel-height", this, Spacecraft2D, setTravelHeight);
    203207}
    204208
     
    208212}
    209213
     214void Spacecraft2D::setTravelSpeed(float travelSpeed)
     215{
     216  this->travelSpeed = travelSpeed;
     217}
     218
     219
     220void Spacecraft2D::setTravelHeight(float travelHeight)
     221{
     222  if (this->toTravelHeight == NULL)
     223    this->toTravelHeight = new float;
     224  *this->toTravelHeight = travelHeight;
     225}
     226
     227
     228
     229
    210230void Spacecraft2D::enter()
    211231{
    212232  dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( true);
    213   this->setPlaymode(Playable::Full3D /*this->getPlaymode()*/);
     233  this->setPlaymode(this->getPlaymode());
    214234}
    215235
     
    252272
    253273        State::getCameraNode()->setParentSoft(this->travelNode);
    254         State::getCameraNode()->setRelCoorSoft(-10, 50,0);
     274        State::getCameraNode()->setRelCoorSoft(-3, 50,0);
    255275        State::getCameraTargetNode()->setParentSoft(this->travelNode);
    256276
     
    369389    case Playable::Horizontal:
    370390      {
     391
     392        if (this->toTravelHeight != NULL)
     393        {
     394          this->travelNode->shiftCoor(Vector(0, (*toTravelHeight - this->travelNode->getAbsCoor().y) * dt, 0));
     395          if (fabsf(this->travelNode->getAbsCoor().y - *this->toTravelHeight) < .1)
     396          {
     397            delete this->toTravelHeight;
     398            this->toTravelHeight = NULL;
     399          }
     400        }
     401        this->travelNode->shiftCoor(Vector(this->travelSpeed * dt, 0, 0));
    371402
    372403        accel.y = 0.0;
  • branches/presentation/src/world_entities/space_ships/spacecraft_2d.h

    r9087 r9097  
    6767    /// 2D-traveling
    6868    PNode*                travelNode;
    69     float                 travelHeight;
    7069    float*                toTravelHeight;
    7170    float                 travelSpeed;        //!< the current speed of the Hove (to make soft movement)
Note: See TracChangeset for help on using the changeset viewer.