Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5451 in orxonox.OLD


Ignore:
Timestamp:
Oct 29, 2005, 4:58:49 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: NPC's die, and emmit a power-UP

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/gui/gtk_gui/gui_flags.cc

    r5450 r5451  
    5959void GuiFlags::setTextFromFlags(Widget* widget)
    6060{
    61   if (widget == NULL)
    62     return;
    6361  FlagInfo flagInfo;
    6462  flagInfo.shortFlags = this->shortFlags;
  • trunk/src/world_entities/npc.cc

    r5427 r5451  
    2424#include "list.h"
    2525#include "stdlibincl.h"
     26#include "power_ups/turret_power_up.h"
    2627
    2728using namespace std;
     
    4344void NPC::collidesWith(WorldEntity* entity, const Vector& location)
    4445{
    45   if (entity->isA(CL_PROJECTILE))
     46  if (entity->isA(CL_PROJECTILE) && entity != this->collider)
    4647  {
    47     PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getName(), entity->getName(), location.x, location.y, location.z);
    48     this->applyForce(Vector(0,0,0)-location*1000);
     48//    PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getName(), entity->getName(), location.x, location.y, location.z);
     49//    this->applyForce(Vector(0,0,0)-location*1000);
     50    if ((float)rand()/RAND_MAX < .3)
     51    {
     52      WorldEntity* powerUp = new TurretPowerUp();
     53      powerUp->setAbsCoor(this->getAbsCoor());
     54      State::getWorldEntityList()->add(powerUp);
     55    }
     56    State::getWorldEntityList()->remove(this);
     57
     58      this->collider = entity;
    4959  }
    5060  else if (entity->isA(CL_PLAYER))
    5161    this->applyForce(Vector(0,0,0)-location*100);
    52   else
     62  else if (entity->isA(CL_NPC))
    5363  {
    5464    this->setVisibiliy(false);
    55    State::getWorldEntityList()->remove(this);
     65    State::getWorldEntityList()->remove(this);
    5666  }
    5767}
  • trunk/src/world_entities/npc.h

    r5257 r5451  
    2525   Vector   randomRotAxis;
    2626
    27 ;
     27   WorldEntity* collider;
    2828
    2929};
  • trunk/src/world_entities/weapons/test_bullet.cc

    r5449 r5451  
    4646  this->energyMax = 10;
    4747  this->remove();
    48   this->lifeSpan = 5;
     48  this->lifeSpan = 2;
    4949
    5050  this->emitter = new ParticleEmitter(Vector(0,1,0), M_2_PI, 100, 5);
Note: See TracChangeset for help on using the changeset viewer.