- Timestamp:
- Jun 20, 2007, 10:29:13 PM (17 years ago)
- Location:
- branches/presentation/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/presentation/src/lib/collision_reaction/cr_object_damage.cc
r10014 r10749 55 55 float damage = 0.0f; 56 56 57 PRINTF( 4)("Dealing damage - Handling collision: %s vs %s\n",57 PRINTF(0)("Dealing damage - Handling collision: %s vs %s\n", 58 58 collision->getEntityA()->getClassCName(), 59 59 collision->getEntityB()->getClassCName()); … … 64 64 damage = collision->getEntityB()->getDamage(); 65 65 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()); 67 67 } 68 68 … … 71 71 damage = collision->getEntityA()->getDamage(); 72 72 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()); 74 74 } 75 75 -
branches/presentation/src/world_entities/npcs/actionbox_enemy.cc
r10745 r10749 191 191 Vector targetDir = State::getPlayer()->getPlayable()->getAbsCoor()-this->getAbsCoor(); 192 192 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 ) 194 194 { 195 195 this->bFire = true; -
branches/presentation/src/world_entities/projectiles/projectile.cc
r10368 r10749 157 157 void Projectile::collidesWith (WorldEntity* target, const Vector& location) 158 158 { 159 dynamic_cast<SpaceShip*>(target)->damage(this->getPhysDamage(),this->getElecDamage());159 //dynamic_cast<SpaceShip*>(target)->damage(this->getPhysDamage(),this->getElecDamage()); 160 160 // this->destroy(NULL); 161 161 this->destroy(target); -
branches/presentation/src/world_entities/projectiles/projectile_weapon.cc
r10368 r10749 150 150 void ProjectileWeapon::collidesWith (WorldEntity* target, const Vector& location) 151 151 { 152 dynamic_cast<SpaceShip*>(target)->damage(this->getPhysDamage(),this->getElecDamage());152 // dynamic_cast<SpaceShip*>(target)->damage(this->getPhysDamage(),this->getElecDamage()); 153 153 // this->destroy(NULL); 154 154 this->destroy(target); -
branches/presentation/src/world_entities/space_ships/space_ship.cc
r10742 r10749 74 74 #include "track/track.h" 75 75 #include "track/action_box.h" 76 77 #include "event_handler.h" 78 79 #include "story_entity.h" 76 80 77 81 … … 421 425 void SpaceShip::tick (float time) 422 426 { 427 if ( deadBox != NULL ) 428 { 429 OrxGui::GLGuiHandler::getInstance()->tick( time ); 430 } 423 431 // printf("SSGROUP: %d\n", this->getOMListNumber()); 424 432 … … 597 605 } 598 606 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 else649 {*/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 655 607 void SpaceShip::respawn( ) 656 608 { 657 609 Playable::respawn(); 658 610 } 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 671 611 672 612 … … 1036 976 this->weaponMan.previousWeaponConfig(); 1037 977 Playable::weaponConfigChanged(); 1038 }1039 1040 void SpaceShip::hit( float damage, WorldEntity* killer)1041 {1042 this->damage(killer->getDamage(),0);1043 978 } 1044 979 … … 1135 1070 }; 1136 1071 1137 1072 void 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 1079 void SpaceShip::destroy( WorldEntity * killer ) 1080 { 1081 Playable::destroy( killer ); 1082 this->showDeadScreen(); 1083 myList = this->getOMListNumber(); 1084 toList( OM_DEAD ); 1085 } 1086 1087 void SpaceShip::onButtonContinue( ) 1088 { 1089 OrxGui::GLGuiHandler::getInstance()->deactivateCursor( true ); 1090 EventHandler::getInstance()->popState(); 1091 WorldEntity::reset(); 1092 toList( myList ); 1093 deadBox->hideAll(); 1094 } 1095 1096 void SpaceShip::onButtonExit( ) 1097 { 1098 State::getCurrentStoryEntity()->setNextStoryID( 0 ); 1099 State::getCurrentStoryEntity()->stop(); 1100 } 1101 1102 void 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 13 13 #include "extendable.h" 14 14 #include "world_entity.h" 15 16 #include "glgui.h" 15 17 16 18 // Forward Declaration … … 43 45 //void setAirFriction(float friction) { this->airFriction = friction; }; 44 46 47 virtual void hit(float damage, WorldEntity* killer); 48 virtual void destroy( WorldEntity* killer ); 49 45 50 virtual void enter(); 46 51 virtual void leave(); … … 51 56 virtual void leftWorld(); 52 57 53 virtual void destroy(WorldEntity* killer);54 58 virtual void respawn(); 55 59 … … 79 83 inline PNode* getTravelNode() { return this->travelNode; }; 80 84 81 //damage handler82 virtual void damage(float pDamage, float eDamage); //!< pDamage physical damage, eDamage electronic damage83 85 84 86 //included by Michel: … … 90 92 virtual void movement (float dt); 91 93 92 93 94 94 void nextWeaponConfig(); 95 95 void previousWeaponConfig(); 96 97 virtual void hit(float damage, WorldEntity* killer); 98 96 99 97 void setCameraDistance(float dist); 100 98 … … 221 219 Trail* trailR; //!< Burst trail 222 220 */ 221 OM_LIST myList; 222 OrxGui::GLGuiBox* deadBox; 223 void onButtonContinue(); 224 void onButtonExit(); 225 void showDeadScreen(); 223 226 224 227 };
Note: See TracChangeset
for help on using the changeset viewer.