Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 7, 2017, 6:25:56 PM (7 years ago)
Author:
vyang
Message:

Problem, dass Leben mehrmals durch einen Asteroiden abgezogen wird, wurde behoben

Location:
code/branches/Asteroid_HS17/src/modules/asteroids2D
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DShip.cc

    r11637 r11643  
    9797    inline bool Asteroids2DShip::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
    9898    {
    99         removeHealth(100);
    100         getGame()->addPoints(10);
     99
     100        orxout() << "touched" << endl;
     101        Asteroids2DStone* stone = orxonox_cast<Asteroids2DStone*>(otherObject);       
     102        if(stone != nullptr && (stone != lastStone || lastStone == nullptr))
     103        {
     104            removeHealth(100);
     105            lastStone = stone;
     106         
     107        }
    101108        return false;
    102109    }
  • code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DShip.h

    r11637 r11643  
    3838#include "asteroids2D/Asteroids2DPrereqs.h"
    3939
     40
    4041#include "core/XMLPort.h"
    4142#include "worldentities/pawns/SpaceShip.h"
     43#include "weapons/WeaponsPrereqs.h"
    4244#include "graphics/Camera.h"
    4345
    4446#include "Asteroids2D.h" // Is necessary for getGame function
    4547//#include "Asteroids2DCenterPoint.h"
     48#include "Asteroids2DStone.h"
    4649
    4750#include "tools/Timer.h"
     
    8083        private:
    8184            Asteroids2D* getGame();
     85
    8286            float width, height;
    8387            WeakPtr<Asteroids2D> game;
    84             WeakPtr<WorldEntity> lastEntity;
    85             struct Velocity
    86             {
    87                 float x;
    88                 float y;
    89             } velocity, desiredVelocity;
     88            WeakPtr<Asteroids2DStone> lastStone;
    9089
    9190            Timer timer;
Note: See TracChangeset for help on using the changeset viewer.