Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3685 in orxonox.OLD for orxonox/trunk/src/world_entities


Ignore:
Timestamp:
Mar 30, 2005, 11:04:39 PM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: fixed a gc issue and implemented firing-frequency. still got some speed problems…

Location:
orxonox/trunk/src/world_entities
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/world_entities/player.cc

    r3683 r3685  
    156156void Player::tick (float time)
    157157{
     158  /* link tick to weapon */
     159  this->activeWeapon->tick(time);
    158160  // player controlled movement
    159161  this->move(time);
  • orxonox/trunk/src/world_entities/projectile.cc

    r3683 r3685  
    3737  this->flightDirection = NULL;
    3838  this->currentLifeTime = 0.0f;
    39   this->ttl = 1.0f;
     39  this->ttl = 0.75f; /* sec */
    4040  this->speed = 2.0f;
    4141}
     
    8989void Projectile::setSpeed(float speed)
    9090{
    91   this->speed = speed * 5;
    92   printf("Projectile::setting speed to: %f\n", this->speed);
     91  this->speed = speed * 3;
     92  PRINTF(4)("Projectile::setting speed to: %f\n", this->speed);
    9393}
    9494
     
    9999void Projectile::tick (float time)
    100100{
    101   this->speed = this->weapon->getSpeed() * 5
     101  this->speed = this->weapon->getSpeed() * 3
    102102  this->shiftCoor(*this->flightDirection * this->speed * time);
    103   printf("current speed is: %f\n", this->speed);
     103  //printf("current speed is: %f\n", this->speed);
    104104
    105105  this->currentLifeTime += time;
    106   if( this->ttl > this->currentLifeTime)
    107     this->finalize();
     106  if( this->ttl < this->currentLifeTime)
     107    {
     108      PRINTF(5)("FINALIZE=============================================================\n");
     109      PRINTF(5)("current life time is: %f/%f\n", this->currentLifeTime, this->ttl);
     110      PRINTF(5)("FINALIZE=============================================================\n");
     111      this->finalize();
     112    }
    108113}
    109114
  • orxonox/trunk/src/world_entities/test_gun.cc

    r3683 r3685  
    4242  :  Weapon (parent, coordinate, direction)
    4343{
     44  this->idleTime = 0.2f;
    4445}
    4546
     
    8384void TestGun::fire()
    8485{
    85   //printf("TestGun::fire() - firing weapon now ---------------------------\n");
     86  if( this->localTime < this->idleTime)
     87    return;
     88
    8689  Projectile* pj = new Projectile(this);
    8790
     
    9699  pj->setSpeed(this->getSpeed());
    97100
    98 
    99 
    100101  this->worldEntities->add(pj);
     102  this->localTime = 0;
    101103}
    102104
     
    128130*/
    129131void TestGun::tick (float time)
    130 {}
     132{
     133  this->localTime += time;
     134}
    131135
    132136
  • orxonox/trunk/src/world_entities/weapon.cc

    r3677 r3685  
    154154*/
    155155void Weapon::setWeaponIdleTime(float time)
    156 {}
     156{
     157  this->idleTime = time;
     158}
    157159
    158160/**
     
    164166*/
    165167float Weapon::getWeaponIdleTime(void)
    166 {}
     168{
     169  return this->idleTime;
     170}
    167171
    168172/**
     
    174178*/
    175179bool Weapon::hasWeaponIdleTimeElapsed(void)
    176 {}
     180{
     181  return (this->localTime>this->idleTime)?true:false;
     182}
    177183
    178184
  • orxonox/trunk/src/world_entities/weapon.h

    r3646 r3685  
    7171 protected:
    7272  tList<WorldEntity>* worldEntities;
     73  float localTime;
     74  float idleTime;
     75  float slowDownFactor;
    7376
    7477 private:
    7578  bool enabled;
    76   float localTime;
    77   float slowDownFactor;
    7879  Projectile* projectile;
    7980  //WeaponSound sound;
Note: See TracChangeset for help on using the changeset viewer.