Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 9, 2019, 11:36:28 AM (5 years ago)
Author:
pomselj
Message:

Worked on Collision, doesn't work yet, compiles tho

File:
1 edited

Legend:

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

    r12345 r12346  
    147147
    148148            // Create the first Wall.
    149             this->LevelUp();
     149            this->createWall();
    150150
    151151            //Create Ship
     
    213213        this->createWall();
    214214        this->activeWalls_.push_back(this->futureWall_);
     215        for (int i = 0; i < this->futureWall_->getNumberOfStones(); i++)
     216            this->stones_.push_back(this->futureWall_->getStone(i));
    215217        //new location of ship
    216218        //new amount of balls
    217219        //create balls
    218220        //insert new wall
    219 
    220221    }
    221222
     
    243244    }
    244245
    245    
     246    OrxoBloxStones* OrxoBlox::CheckForCollision(OrxoBloxBall* Ball) {
     247
     248        orxout() << "Checking for Collision" << endl;
     249        Vector3 BallPosition = Ball->getPosition();
     250        for(OrxoBloxStones* someStone : this->stones_)
     251        {
     252            orxout() << "Checking a stone" << endl;
     253            const Vector3& StonePosition = someStone->getPosition(); //!< Saves the position of the currentStone
     254            int size = someStone->getSize();
     255            if((BallPosition.x >= StonePosition.x - size && BallPosition.x <= StonePosition.x + size) ||
     256                (BallPosition.z >= StonePosition.z - size && BallPosition.z <= StonePosition.z + size)) {
     257                orxout() << "FOUND ONE" << endl;
     258                return someStone;
     259            }
     260        }
     261        orxout() << "Found nothing...." << endl;
     262        return nullptr;
     263    }
    246264   
    247265}
Note: See TracChangeset for help on using the changeset viewer.