Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10749 in orxonox.OLD


Ignore:
Timestamp:
Jun 20, 2007, 10:29:13 PM (17 years ago)
Author:
rennerc
Message:

die player die

Location:
branches/presentation/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/presentation/src/lib/collision_reaction/cr_object_damage.cc

    r10014 r10749  
    5555    float damage = 0.0f;
    5656
    57     PRINTF(4)("Dealing damage - Handling collision: %s vs %s\n",
     57    PRINTF(0)("Dealing damage - Handling collision: %s vs %s\n",
    5858              collision->getEntityA()->getClassCName(),
    5959              collision->getEntityB()->getClassCName());
     
    6464      damage = collision->getEntityB()->getDamage();
    6565      collision->getEntityA()->hit(damage, collision->getEntityB());
    66       PRINTF(4)("Dealing damage - %f damage to %s \n", damage, collision->getEntityA()->getClassCName());
     66      PRINTF(0)("Dealing damage - %f damage to %s \n", damage, collision->getEntityA()->getClassCName());
    6767    }
    6868
     
    7171      damage = collision->getEntityA()->getDamage();
    7272      collision->getEntityB()->hit(damage, collision->getEntityA());
    73       PRINTF(4)("Dealing damage - %f damage to %s \n", damage, collision->getEntityB()->getClassCName());
     73      PRINTF(0)("Dealing damage - %f damage to %s \n", damage, collision->getEntityB()->getClassCName());
    7474    }
    7575
  • branches/presentation/src/world_entities/npcs/actionbox_enemy.cc

    r10745 r10749  
    191191    Vector targetDir = State::getPlayer()->getPlayable()->getAbsCoor()-this->getAbsCoor();
    192192    moveTowards( targetPos, targetDir, dt );
    193     if ( this->getAbsDir().apply( Vector(1, 0, 0) ).dot(targetDir) > 0.9 )
     193    if ( this->getAbsDir().apply( Vector(1, 0, 0) ).dot(targetDir) > 0.9 && State::getPlayer()->getPlayable()->getOMListNumber()!=OM_DEAD )
    194194    {
    195195      this->bFire = true;
  • branches/presentation/src/world_entities/projectiles/projectile.cc

    r10368 r10749  
    157157void Projectile::collidesWith (WorldEntity* target, const Vector& location)
    158158{
    159   dynamic_cast<SpaceShip*>(target)->damage(this->getPhysDamage(),this->getElecDamage());
     159  //dynamic_cast<SpaceShip*>(target)->damage(this->getPhysDamage(),this->getElecDamage());
    160160//   this->destroy(NULL);
    161161  this->destroy(target);
  • branches/presentation/src/world_entities/projectiles/projectile_weapon.cc

    r10368 r10749  
    150150void ProjectileWeapon::collidesWith (WorldEntity* target, const Vector& location)
    151151{
    152   dynamic_cast<SpaceShip*>(target)->damage(this->getPhysDamage(),this->getElecDamage());
     152//  dynamic_cast<SpaceShip*>(target)->damage(this->getPhysDamage(),this->getElecDamage());
    153153//   this->destroy(NULL);
    154154  this->destroy(target);
  • branches/presentation/src/world_entities/space_ships/space_ship.cc

    r10742 r10749  
    7474#include "track/track.h"
    7575#include "track/action_box.h"
     76
     77#include "event_handler.h"
     78
     79#include "story_entity.h"
    7680
    7781
     
    421425void SpaceShip::tick (float time)
    422426{
     427  if ( deadBox != NULL )
     428  {
     429    OrxGui::GLGuiHandler::getInstance()->tick( time );
     430  }
    423431 // printf("SSGROUP: %d\n", this->getOMListNumber());
    424432
     
    597605}
    598606
    599 void SpaceShip::destroy( WorldEntity* killer )
    600 {
    601   if(this->hasPlayer())
    602     Playable::destroy( killer);
    603 
    604   PRINTF(5)("spaceship destroy\n");
    605 
    606   EmitterNode* node  = NULL;
    607   DotEmitter* emitter = NULL;
    608   SpriteParticles*  explosionParticles  = NULL;
    609 
    610   explosionParticles = new SpriteParticles(200);
    611   explosionParticles->setName("SpaceShipExplosionParticles");
    612   explosionParticles->setLifeSpan(.2, .3);
    613   explosionParticles->setRadius(0.0, 10.0);
    614   explosionParticles->setRadius(.5, 6.0);
    615   explosionParticles->setRadius(1.0, 3.0);
    616   explosionParticles->setColor(0.0, 1,1,1,.9);
    617   explosionParticles->setColor(0.1,  1,1,0,.9);
    618   explosionParticles->setColor(0.5, .8,.4,0,.5);
    619   explosionParticles->setColor(1.0, .2,.2,.2,.5);
    620 
    621 
    622   emitter = new DotEmitter( 2000, 70, 360);
    623   //emitter->setSpread( 0, M_2_PI);
    624   emitter->setEmissionRate( 200.0);
    625   //emitter->setEmissionVelocity( 200.0);
    626   //emitter->setSystem( explosionParticles);
    627   //emitter->setAbsCoor( this->getAbsCoor());
    628 
    629   node  = new EmitterNode( .1f);
    630   node->setupParticle( emitter, explosionParticles);
    631   node->setAbsDir( this->getAbsDir());
    632   node->setVelocity( this->getVelocity() * .9f);
    633   node->setAbsCoor( this->getAbsCoor());
    634   if( !node->start())
    635     PRINTF(0)("Explosion node not correctly started!");
    636 /*
    637   PNode* node          = new PNode();
    638   node->setAbsCoor(this->getAbsCoor());
    639   Explosion* explosion = new Explosion();
    640   explosion->explode( node, Vector(5,5,5));
    641 */
    642 /*
    643   if( this->hasPlayer())
    644   {
    645         this->setAbsCoor(Vector(-10000,10000,10000));
    646         this->hide();
    647   }
    648   else
    649   {*/
    650     this->setAbsCoor( this->getAbsCoor() + Vector(100,0,0) + Vector(1,0,0) * VECTOR_RAND(150).dot(Vector(1,0,0)));
    651   //}
    652 
    653 }
    654 
    655607void SpaceShip::respawn( )
    656608{
    657609  Playable::respawn();
    658610}
    659 
    660 
    661 void SpaceShip::damage(float pDamage, float eDamage){
    662   PRINTF(5)("ship hit for (%f,%f) \n",pDamage,eDamage);
    663 
    664   static float tmp = this->decreaseShield(pDamage);
    665   if( tmp > 0)
    666   if ( this->decreaseHealth(tmp / 2) > 0)
    667     this->destroy(this);
    668 
    669 }
    670 
    671611
    672612
     
    1036976  this->weaponMan.previousWeaponConfig();
    1037977  Playable::weaponConfigChanged();
    1038 }
    1039 
    1040 void SpaceShip::hit( float damage, WorldEntity* killer)
    1041 {
    1042   this->damage(killer->getDamage(),0);
    1043978}
    1044979
     
    11351070};
    11361071
    1137 
     1072void SpaceShip::hit( float damage, WorldEntity * killer )
     1073{
     1074  PRINTF(0)("SS HIT: %f\n", this->getHealth() );
     1075  Playable::hit( damage, killer );
     1076  PRINTF(0)("SS HIT: %f\n", this->getHealth() ); 
     1077}
     1078
     1079void SpaceShip::destroy( WorldEntity * killer )
     1080{
     1081  Playable::destroy( killer );
     1082  this->showDeadScreen();
     1083  myList = this->getOMListNumber();
     1084  toList( OM_DEAD );
     1085}
     1086
     1087void SpaceShip::onButtonContinue( )
     1088{
     1089  OrxGui::GLGuiHandler::getInstance()->deactivateCursor( true );
     1090  EventHandler::getInstance()->popState();
     1091  WorldEntity::reset();
     1092  toList( myList );
     1093  deadBox->hideAll();
     1094}
     1095
     1096void SpaceShip::onButtonExit( )
     1097{
     1098  State::getCurrentStoryEntity()->setNextStoryID( 0 );
     1099  State::getCurrentStoryEntity()->stop();
     1100}
     1101
     1102void SpaceShip::showDeadScreen( )
     1103{
     1104  EventHandler::getInstance()->pushState( ES_MENU );
     1105
     1106  OrxGui::GLGuiHandler::getInstance()->activateCursor();
     1107 
     1108  if ( deadBox )
     1109    delete deadBox;
     1110  deadBox = new OrxGui::GLGuiBox();
     1111  deadBox->setAbsCoor2D( 100, 100 );
     1112
     1113  OrxGui::GLGuiText* text = new OrxGui::GLGuiText();
     1114  text->setText( "Game Over! - You died!" );
     1115  OrxGui::GLGuiPushButton* exitButton = new OrxGui::GLGuiPushButton( "exit" );
     1116  exitButton->released.connect(this, &SpaceShip::onButtonExit);
     1117  OrxGui::GLGuiPushButton* continueButton = new OrxGui::GLGuiPushButton( "continue" );
     1118  continueButton->released.connect(this, &SpaceShip::onButtonContinue);
     1119
     1120  deadBox->pack( text );
     1121  deadBox->pack( continueButton );
     1122  deadBox->pack( exitButton );
     1123
     1124  deadBox->showAll();
     1125}
     1126
     1127
     1128
  • branches/presentation/src/world_entities/space_ships/space_ship.h

    r10721 r10749  
    1313#include "extendable.h"
    1414#include "world_entity.h"
     15
     16#include "glgui.h"
    1517
    1618// Forward Declaration
     
    4345    //void setAirFriction(float friction) { this->airFriction = friction; };
    4446
     47    virtual void hit(float damage, WorldEntity* killer);
     48    virtual void destroy( WorldEntity* killer );
     49   
    4550    virtual void enter();
    4651    virtual void leave();
     
    5156    virtual void leftWorld();
    5257
    53     virtual void destroy(WorldEntity* killer);
    5458    virtual void respawn();
    5559
     
    7983    inline PNode* getTravelNode() { return this->travelNode; };
    8084
    81     //damage handler
    82     virtual void damage(float pDamage, float eDamage);  //!< pDamage physical damage, eDamage electronic damage
    8385
    8486    //included by Michel:
     
    9092    virtual void movement (float dt);
    9193
    92 
    93 
    9494    void nextWeaponConfig();
    9595    void previousWeaponConfig();
    96 
    97     virtual void hit(float damage, WorldEntity* killer);
    98 
     96   
    9997    void setCameraDistance(float dist);
    10098
     
    221219    Trail*                trailR;              //!< Burst trail
    222220*/
     221    OM_LIST myList;
     222    OrxGui::GLGuiBox* deadBox;
     223    void onButtonContinue();
     224    void onButtonExit();
     225    void showDeadScreen();
    223226
    224227};
Note: See TracChangeset for help on using the changeset viewer.