Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 11, 2017, 3:18:27 PM (7 years ago)
Author:
jkindle
Message:

Added the animation for the level end (walk into castle), Coins for the blocks, Castleblocks and Flagblocks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBQBlock.cc

    r11405 r11416  
    2121 *
    2222 *   Author:
    23  *      Fabien Vultier
     23 *      Julien Kindle
    2424 *   Co-authors:
    25  *      ...
     25 *     
    2626 *
    2727 */
     
    3838#include "SOB.h"
    3939#include "SOBMushroom.h"
     40#include "SOBCoin.h"
    4041
    4142namespace orxonox
     
    4748        RegisterObject(SOBQBlock);
    4849        used_ = false;
    49    
    50         // setPosition(Vector3(0,0,0));
    51         // setVelocity(Vector3(0,0,0));
    52         // setAcceleration(Vector3(0,0,0));
    53         // setProperties(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
     50
    5451    }
    5552
     
    6259    bool SOBQBlock::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) {
    6360
     61
     62        //If you hit the QBlock, the visibility of all attached objects get inverted! Pretty easy way to create changing blocks :)
    6463        float v_z = otherObject->getVelocity().z;
    6564        if (!used_ && v_z > 50.0) {
     
    7069
    7170            SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
     71
     72            //Spawn either a powerup mushroom or a coin animation (also just an object, have a look at the SOBCoin class)
     73            //The spawn methods are declared at the bottom of this file
    7274            if (type_ == "Coin") {
    7375                SOBGame->addCoin();
     76                spawnCoin();
    7477            }
    7578            if (type_ == "Mushroom") {
     
    9194
    9295
     96     //The spawnmethods from above
    9397     void SOBQBlock::spawnMushroom() {
    9498        SOBCenterpoint* center_ = ((SOB*)getGametype())->center_;
     
    101105        {
    102106            mush->addTemplate("mushroom");
    103            
     107            mush->setPosition(spawnpos);
     108           
     109        }
     110     }
    104111
     112          void SOBQBlock::spawnCoin() {
     113        SOBCenterpoint* center_ = ((SOB*)getGametype())->center_;
    105114
    106             //newBoots->addTemplate(center_->getBootsTemplate());
     115         SOBCoin* mush = new SOBCoin(center_->getContext());
     116         Vector3 spawnpos = this->getWorldPosition();
     117         spawnpos.z += 0;
     118
     119        if (mush != nullptr && center_ != nullptr)
     120        {
     121            mush->addTemplate("coin");
    107122            mush->setPosition(spawnpos);
    108             //newBoots->setProperties(leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);
    109             //newBoots->setFigure(figure_);
    110             //center_->attach(newBoots);
     123       
    111124        }
    112125     }
Note: See TracChangeset for help on using the changeset viewer.