Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 19, 2006, 11:39:59 PM (18 years ago)
Author:
marcscha
Message:

Collision fixes, further additions

Location:
branches/playability/src/world_entities/space_ships
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/playability/src/world_entities/space_ships/space_ship.cc

    r10109 r10113  
    3434#include "particles/emitter_node.h"
    3535#include "particles/sprite_particles.h"
    36 #include "effects/explosion.h"
    3736#include "effects/trail.h"
    3837
     
    5251#include "state.h"
    5352#include "player.h"
     53
    5454
    5555#include "util/loading/load_param.h"
     
    173173  this->weaponMan.addWeapon( wpLeft1, 0, 0);
    174174  this->weaponMan.addWeapon( wpRight1, 0, 1);
    175   this->weaponMan.addWeapon( wpLeft2, 0, 2);
    176   this->weaponMan.addWeapon( wpRight2, 0, 3);
    177   this->weaponMan.addWeapon( wpLeft3, 0, 4);
    178   this->weaponMan.addWeapon( wpRight3, 0, 5);
    179 
    180   this->secWeaponMan.addWeapon( cannon, 1, 0);
    181 
    182   this->weaponMan.changeWeaponConfig(0);
    183   this->secWeaponMan.changeWeaponConfig(1);
     175  this->weaponMan.addWeapon( wpLeft2, 1, 0);
     176  this->weaponMan.addWeapon( wpRight2, 1, 1);
     177  this->weaponMan.addWeapon( wpLeft3, 2, 0);
     178  this->weaponMan.addWeapon( wpRight3, 2, 1);
     179
     180  this->secWeaponMan.addWeapon( cannon, 0, 0);
     181
    184182
    185183  wpRight1->requestAction(WA_ACTIVATE);
    186184  wpLeft1->requestAction(WA_ACTIVATE);
     185
    187186  wpRight2->requestAction(WA_ACTIVATE);
    188187  wpLeft2->requestAction(WA_ACTIVATE);
     
    192191  cannon->requestAction(WA_ACTIVATE);
    193192
    194   curWeaponPrimary    = 0;
     193 
     194  this->weaponMan.changeWeaponConfig(1);
     195  this->secWeaponMan.changeWeaponConfig(0);
     196
     197  curWeaponPrimary    = 1;
    195198  curWeaponSecondary  = 0;
    196199
     
    339342  this->trailR->setTexture( "maps/engine.png");
    340343
    341  
     344
    342345  this->toList(OM_GROUP_00);
    343346}
     
    376379  this->secWeaponMan.showCrosshair();
    377380  this->toList( OM_GROUP_01 );
    378  
    379   for(ObjectList<PNode>::const_iterator it = this->getNodesChildren().begin(); it != this->getNodesChildren().end(); it++)
    380   {
    381     if( likely( dynamic_cast<Weapon*>(*it) != NULL))
    382       dynamic_cast<WorldEntity*>(*it)->toList( OM_GROUP_01);
    383   }
    384381  //dynamic_cast<Element2D*>(this->secWeaponMan.getFixedTarget())->setVisibility( true);
    385382  //this->attachCamera();
     
    391388  this->secWeaponMan.hideCrosshair();
    392389  this->toList( OM_GROUP_00);
    393  
    394   for(ObjectList<PNode>::const_iterator it = this->getNodesChildren().begin(); it != this->getNodesChildren().end(); it++)
    395   {
    396     if( likely( dynamic_cast<Weapon*>(*it) != NULL))
    397       dynamic_cast<WorldEntity*>(*it)->toList( OM_GROUP_00);
    398   }
    399390  //dynamic_cast<Element2D*>(this->secWeaponMan.getFixedTarget())->setVisibility( false);
    400391  //this->detachCamera();
     
    516507  this->trailR->tick(time);
    517508
     509  this->weaponMan.setParentEntity( this);
     510  this->secWeaponMan.setParentEntity( this);
     511
    518512  //orient the spaceship in direction of the mouse
    519513  /*
     
    558552{
    559553  //Playable::process(event);
    560 
     554 
    561555  if( event.type == KeyMapper::PEV_LEFT)
    562556    this->bLeft = event.bPressed;
     
    571565  else if( event.type == KeyMapper::PEV_FIRE1)
    572566    this->bFire = event.bPressed;
     567  else if( event.type == KeyMapper::PEV_NEXT_WEAPON && event.bPressed)
     568  {
     569    this->nextWeaponConfig();
     570  }
     571  else if ( event.type == KeyMapper::PEV_PREVIOUS_WEAPON && event.bPressed)
     572    this->previousWeaponConfig();
    573573
    574574
     
    632632  else
    633633  {
    634     this->setAbsCoor( this->getAbsCoor() + Vector(150,0,0) + Vector(1,0,0) * VECTOR_RAND(50).dot(Vector(1,0,0)));
     634    this->setAbsCoor( this->getAbsCoor() + Vector(100,0,0) + Vector(1,0,0) * VECTOR_RAND(150).dot(Vector(1,0,0)));
    635635  }
    636636
     
    963963}
    964964
     965/**
     966 * @brief jumps to the next WeaponConfiguration
     967 */
     968void SpaceShip::nextWeaponConfig()
     969{
     970 
     971  this->curWeaponPrimary    = (curWeaponPrimary + 1) % 3;
     972  this->weaponMan.changeWeaponConfig(this->curWeaponPrimary);
     973  Playable::weaponConfigChanged();
     974}
     975
     976/**
     977 * @brief moves to the last WeaponConfiguration
     978 */
     979void SpaceShip::previousWeaponConfig()
     980{
     981  this->curWeaponPrimary    = (curWeaponPrimary + 1) % 3;
     982  this->weaponMan.changeWeaponConfig(this->curWeaponPrimary);
     983  Playable::weaponConfigChanged();
     984}
  • branches/playability/src/world_entities/space_ships/space_ship.h

    r10098 r10113  
    7878    void setPlaymodeXML(const std::string& playmode);
    7979    virtual void movement (float dt);
     80
     81    void nextWeaponConfig();
     82    void previousWeaponConfig();
     83
     84    inline void hit(float damage, WorldEntity* killer) { this->collidesWith(killer, this->getAbsCoor()); killer->collidesWith(this, this->getAbsCoor()); } ;
    8085
    8186  private:
Note: See TracChangeset for help on using the changeset viewer.