Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 12356


Ignore:
Timestamp:
May 9, 2019, 2:20:32 PM (5 years ago)
Author:
pomselj
Message:

Bounces ok-ish, still seg fault… stones get destroyed but models stay, maybe destroy wals too

Location:
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.cc

    r12350 r12356  
    3333
    3434#include "OrxoBloxBall.h"
     35#include "OrxoBloxStones.h"
    3536#include "OrxoBlox.h"
    3637#include <bullet/BulletCollision/NarrowPhaseCollision/btManifoldPoint.h>
     
    295296
    296297
    297     void OrxoBloxBall::Bounce(OrxoBloxStones* otherObject) {
     298    void OrxoBloxBall::Bounce(OrxoBloxStones* Stone) {
    298299
    299300        Vector3 velocity = this->getVelocity();
    300         Vector3 positionOtherObject = otherObject->getPosition();
     301        Vector3 positionStone = Stone->getPosition();
    301302        Vector3 myPosition = this->getPosition();
    302303        orxout() << "About to Bounce >D" << endl;
     
    306307        //else {
    307308       
    308             int distance_X = myPosition.x - positionOtherObject.x;
    309             int distance_Z = myPosition.z - positionOtherObject.z;
     309            int distance_X = myPosition.x - positionStone.x;
     310            int distance_Z = myPosition.z - positionStone.z;
    310311
    311312            if (distance_X < 0)
     
    336337
    337338
    338     void OrxoBloxBall::Collides(OrxoBloxStones* otherObject)
    339     {
    340 
    341         if(otherObject == nullptr)
     339    void OrxoBloxBall::Collides(OrxoBloxStones* Stone)
     340    {
     341
     342        if(Stone == nullptr)
    342343            return;
    343344
    344345        orxout() << "About to Bounce >D" << endl;
    345         Bounce(otherObject);
     346        Bounce(Stone);
     347        //if(otherObject->getHealth() <= 0) {
     348            Stone->destroy();
     349        //}
     350        //otherObject->reduceHealth();
    346351    }
    347352
  • code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.h

    r12349 r12356  
    135135            const std::string& getDefBoundarySound();
    136136
     137            unsigned int getHealth();
     138
    137139        private:
    138140            void registerVariables();
     
    151153            WorldSound* defBoundarySound_;
    152154            OrxoBlox* orxoblox_;
    153        
    154155    };
    155156}
  • code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxStones.cc

    r12342 r12356  
    2121        this->delay_ = false;
    2222    }
     23
     24    unsigned int OrxoBloxStones::getHealth() {
     25        return this->health_;
     26    }
     27
     28    void OrxoBloxStones::reduceHealth() {
     29        this->health_ -= 1;
     30    }
    2331}
  • code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxStones.h

    r12331 r12356  
    6363            void setGame(OrxoBlox* orxoblox)
    6464                { assert(orxoblox); orxoblox_ = orxoblox; }
     65
     66            unsigned int getHealth();
     67
     68            void reduceHealth();
    6569               
    6670        private:
Note: See TracChangeset for help on using the changeset viewer.