Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3584 in orxonox.OLD for orxonox


Ignore:
Timestamp:
Mar 16, 2005, 11:26:57 PM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: connected the weapon system to the input_node structure

Location:
orxonox/trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/orxonox.conf

    r2636 r3584  
    55RIGHT=right
    66SPACE=fire
     7m=weapon_mode
    78ESCAPE=quit
    89p=pause
  • orxonox/trunk/src/world_entities/player.cc

    r3583 r3584  
    8383}
    8484
    85 /**
    86    \brief the function called for each passing timeSnap
    87    \param time The timespan passed since last update
    88 */
    89 void Player::tick (float time)
    90 {
    91   // movement
    92   this->move (time);
    93 }
     85
     86/**
     87   \brief the action occuring if the player left the game
     88*/
     89void Player::leftWorld ()
     90{}
     91
     92
    9493
    9594/**
     
    113112}
    114113
    115 /**
    116    \brief The connection to the command node
    117    \param cmd the Command unit from witch to map
    118 
    119    here the commands are mapped to the players movement/weaponary
    120 */
    121 void Player::command (Command* cmd)
    122 {
    123   //printf("Player|recieved command [%s]\n", cmd->cmd);
    124   if( !strcmp( cmd->cmd, "up")) bUp = !cmd->bUp;
    125   else if( !strcmp( cmd->cmd, "down")) bDown = !cmd->bUp;
    126   else if( !strcmp( cmd->cmd, "left")) bLeft = !cmd->bUp;
    127   else if( !strcmp( cmd->cmd, "right")) bRight = !cmd->bUp;
    128   else if( !strcmp( cmd->cmd, "fire")) bFire = !cmd->bUp;
    129 }
    130114
    131115/**
     
    151135
    152136
    153 /*PN
    154   void Player::getLookat(Location* locbuf)
    155   {
    156   *locbuf = *getLocation();
    157   //locbuf->dist += 5.0;
    158   }
    159 */
    160 
    161 /**
    162    \brief the action occuring if the player left the game
    163 */
    164 void Player::leftWorld ()
    165 {
    166 }
     137/**
     138   \brief the function called for each passing timeSnap
     139   \param time The timespan passed since last update
     140*/
     141void Player::tick (float time)
     142{
     143  // player controlled movement
     144  this->move (time);
     145  // weapon system manipulation
     146  this->fire();
     147}
     148
    167149
    168150/**
     
    174156  Vector accel(0.0, 0.0, 0.0);
    175157  /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */
    176   //Placement *pos = getPlacement();
    177158 
    178159  /* calculate the direction in which the craft is heading  */
     
    189170  if( bDescend) {/* FIXME */} /* \todo up and down player movement */
    190171
    191   //Location* l = getLocation();
    192  
    193   // r(t) = r(0) + v(0)*t + 1/2*a*t^2
    194   // r = position
    195   // v = velocity
    196   // a = acceleration
    197 
    198   /* this the base-speed of the player: determines how fast and how the player follows the track*/
    199   //l->dist = l->dist + travelSpeed * time;
    200  
    201   //  Vector* shift = new Vector (this->travelSpeed * time, 0, 0);
    202   //  this->shiftCoor (shift);
    203  
    204   /* this updates the player position on the track - user interaction */
    205   //l->pos = l->pos + accel*time;
    206172  Vector move = accel * time;
    207173  this->shiftCoor (&move);
    208174}
     175
     176
     177/**
     178   \brief weapon manipulation by the player
     179*/
     180void Player::fire()
     181{
     182  if(this->bFire)
     183    {
     184
     185    }
     186  if(this->bWeaponChange)
     187    {
     188
     189    }
     190}
     191
     192
     193/**
     194   \brief The connection to the command node
     195   \param cmd the Command unit from witch to map
     196
     197   here the commands are mapped to the players movement/weaponary
     198*/
     199void Player::command (Command* cmd)
     200{
     201  //printf("Player|recieved command [%s]\n", cmd->cmd);
     202  if( !strcmp( cmd->cmd, "up")) this->bUp = !cmd->bUp;
     203  else if( !strcmp( cmd->cmd, "down")) this->bDown = !cmd->bUp;
     204  else if( !strcmp( cmd->cmd, "left")) this->bLeft = !cmd->bUp;
     205  else if( !strcmp( cmd->cmd, "right")) this->bRight = !cmd->bUp;
     206  else if( !strcmp( cmd->cmd, "fire")) this->bFire = !cmd->bUp;
     207  else if( !strcmp( cmd->cmd, "weapon_mode")) this->bWeaponChange = !cmd->bUp;
     208}
  • orxonox/trunk/src/world_entities/player.h

    r3583 r3584  
    4343  bool bDescend;         //!< descend button presses.
    4444  bool bFire;            //!< fire button pressed.
     45  bool bWeaponChange;     //!< weapon change button pressed
    4546
    4647  tList<Weapon>* weapons;//!< a list of weapon
     
    5152 
    5253  void move(float time);
     54  void fire(void);
    5355 
    5456};
Note: See TracChangeset for help on using the changeset viewer.