Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 24, 2018, 3:03:43 PM (7 years ago)
Author:
micwagne
Message:

added Tube Function in Game

Location:
code/branches/SuperOrxoBros_FS18/src/modules/superorxobros
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/CMakeLists.txt

    r11783 r11987  
    33  SOBCenterpoint.cc
    44  SOB.cc
     5  SOBTube.cc
    56  SOBFigure.cc
    67  SOBItem.cc
     
    1415  SOBCoin.cc
    1516  SOBGumbaBoss.cc
     17 
    1618
    1719)
  • code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOB.cc

    r11783 r11987  
    149149        //If player has reached end of level
    150150        if (this->figure_ != nullptr && figure_->lvlEnded_) {
    151             std::stringstream a;
     151            std::stringstream a;setLvl(2);
    152152            if(!newHighscore){
    153153                a << "Nice! " << getPoints() << " Points in " << (400-getTimeLeft())/2 <<"s.\n\nPress <Space> to restart";
  • code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOBFigure.cc

    r11783 r11987  
    4343#include <OgreMath.h>
    4444
     45#include "SOBTube.h"
    4546#include "SOBMushroom.h"
    4647#include "SOBGumba.h"
     
    5051#include "SOBFlagstone.h"
    5152#include "SOBCastlestone.h"
    52 #include "SOBFireball.h"
    5353#include "Highscore.h"
    5454#include <BulletCollision/NarrowPhaseCollision/btManifoldPoint.h>
     
    7272        firePressed_        = false;
    7373        collDisZ_           = 0;
    74 
     74        tube                = NULL;
     75
     76        //Variables for Action in Tube
     77        tcol_               = false;
     78        tubing              = false;
     79        kkk                 = 0;
     80       
    7581        //Times and turning
    7682        timeSinceLastFire_  = 0.0;
     
    8995        reachedLvlEndState_ = 0;
    9096
     97        positiontube_=10000;
    9198        // Properties concerning PowerUps and items
     99       
    92100        PowerUpCounter_     = 0;
    93101        maxPowerUp_         = 2;
     
    112120
    113121        //Orxocast returns object with casted type if otherObject has that class, and if not a nullptr
     122        //SOBTube* test;
     123       
    114124        SOBMushroom*    mush        = orxonox_cast<SOBMushroom*>    (otherObject);
     125        tube                        = orxonox_cast<SOBTube*>        (otherObject);
    115126        SOBGumba*       gumba       = orxonox_cast<SOBGumba*>       (otherObject);
    116127        SOBGumbaBoss*   gumbaBoss   = orxonox_cast<SOBGumbaBoss*>   (otherObject);
     
    121132
    122133
     134
    123135        //Check if otherObject is a powerup-mushroom
    124136        if (mush != nullptr && !(mush->hasCollided_)) {
     
    133145           
    134146           
    135         }
    136 
    137        
    138 
    139         //Check if otherObject is a Gumba (that walking enemies)
    140 
    141          else if (gumba != nullptr && gumbaBoss == nullptr && !(gumba->hasCollided_)) {
     147        }else if(tube != nullptr && !(tube->hasCollided_)){ //Check if other Object is a tube and set position wher tube is in positiontube_
     148            tube->hasCollided_=true;positiontube_=getPosition().x;tcol_=true; //tcol_ used for movedown function in SOBfigure.cc
     149               
     150
     151
     152        }else if (gumba != nullptr && gumbaBoss == nullptr && !(gumba->hasCollided_)) {
     153            //Check if otherObject is a Gumba (that walking enemies)
    142154
    143155            //If player jumps on its head, kill the Gumba, else, kill the player
     
    209221    return 1;
    210222}
    211 
     223/*bool SOBFigure::tubeAction(){
     224return true;
     225}*/
    212226//Function to spawn the Fireball
    213227void SOBFigure::spawnFireball() {
     
    240254{
    241255    SUPER(SOBFigure, tick, dt);
    242 
     256   
    243257
    244258    bool inputAllowed = true;
    245     //SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
     259   
    246260
    247261    //the particle spawner that generates the fire from the backpack when pressed
     
    291305            velocity.y = 0;
    292306        //If player falls in a hole
    293         if (position.z < -100) {
     307        if (position.z < -180) {
    294308            dead_ = true;
    295309            SOBGame->setDone(true);
     
    355369
    356370        //If moveUp pressed, fire a fireball
    357         if(moveUpPressed_ && (PowerUpCounter_ >= FireballPower) && fireallowed_)
     371        if(moveUpPressed_ && inputAllowed) //if pressed up jump through tube if you are underground
    358372        {
     373            Vector3 position1 = getPosition();
     374
     375             
     376               
     377               
     378                if(position1.z>=-100 && position1.z<=-40){
     379                    position1.z=40;
     380                    if(460<=position1.x && position1.x<480){setPosition(position1);}  //little hack works without this but first tube must be touched     //position where second tube is
     381                    if(positiontube_-10<=position1.x && position1.x<positiontube_+10){      //function for jumping through any SOBtube`s
     382                    setPosition(position1);}}
     383
     384
     385            if((PowerUpCounter_ >= FireballPower) && fireallowed_){
    359386            spawnFireball();
     387
    360388            fireallowed_  = false;
    361             firecooldown_ = 0;
     389            firecooldown_ = 0;}
     390        }
     391       
     392         if(moveDownPressed_ && inputAllowed ){ //if movedownpressed change collisiontype of tube and slip through tube
     393               
     394             
     395                Vector3 position1 = getPosition();
     396             
     397
     398               
     399           
     400               if(tube != nullptr && !(tube->movedown)){ //Check if other Object is a tube
     401               
     402                if(positiontube_-10<position1.x && position1.x<positiontube_+10){
     403                tube->movedown=true;}
     404                }
     405   
    362406        }
    363407
     
    419463    moveLeftPressed_    = false;
    420464    moveRightPressed_   = false;
     465   
    421466
    422467    isColliding_ = false;
  • code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOBFigure.h

    r11783 r11987  
    3232#include "superorxobros/SOBPrereqs.h"
    3333#include "worldentities/ControllableEntity.h"
     34#include "SOBTube.h"
    3435
    3536
     
    5859            //Soooo many declarations
    5960            bool fireallowed_;
    60 
    61             bool moveUpPressed_;
     61            SOBTube*       tube; //class SOBTube* used because tube needs to be global using in collides against function and tick function in SOBfigure.cc
     62            bool moveUpPressed_;
     63            int kkk;
     64           
     65            bool tcol_;  //used for getting through tube
     66            bool tubing; //used for getting through tube
    6267            bool moveDownPressed_;
    6368            bool moveLeftPressed_;
     
    6873            float lastSpeed_z;
    6974            float firecooldown_;
     75            float positiontube_;
    7076            bool isColliding_;
    7177            WorldEntity* particlespawner_;
  • code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOBGumba.cc

    r11783 r11987  
    106106    {
    107107        SUPER(SOBGumba, tick, dt);
    108 
     108       
    109109        if (!changeAllowed_) {
    110110            changedOn_+= dt;
  • code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOBItem.h

    r11783 r11987  
    4949            virtual void setFigure(SOBFigure* newFigure);
    5050            virtual  bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
    51 
    5251         
    5352            bool attachedToFigure_;
  • code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOBPrereqs.h

    r11783 r11987  
    8080    class SOBCastlestone;
    8181    class SOBCoin;
     82    class SOBTube;
    8283
    8384}
Note: See TracChangeset for help on using the changeset viewer.