Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11416


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

Location:
code/branches/SuperOrxoBros_FS17
Files:
4 added
21 edited

Legend:

Unmodified
Added
Removed
  • code/branches/SuperOrxoBros_FS17/data/levels/SOB.oxw

    r11414 r11416  
    2626        </Template>
    2727
     28                <Template name=coin defaults=0 >
     29                <SOBCoin speed = 15 lifetime = 0.7>
     30                        <attached>
     31                                <Model mesh="Pilz.mesh" position="0,0,11" scale=3 pitch=90/>
     32                        </attached>
     33                       
     34                </SOBCoin>
     35        </Template>
     36
    2837
    2938
     
    7281                <Scene ambientlight="1.0, 1.0, 1.0" skybox="Orxonox/skyBoxBasic">
    7382                        <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
    74                         <SpawnPoint position="991.729, -110.11, 435.404" orientation="0.534038, 0.563456, 0.212168, 0.593553" />
    75 
    76 
    77 
     83                        <SpawnPoint position="1984,-5,88 " orientation="0.534038, 0.563456, 0.212168, 0.593553" />
     84
     85<!--    991.729, -110.11, 435.404
     86-->
    7887
    7988
     
    118127
    119128
    120                                         <SOBGumba collisionType="dynamic" speed=30>
     129
     130                                        <SOBGumba collisionType="dynamic" speed=30 position = "320,0,0">
    121131                                                <attached>
    122132                                                        <Model mesh="Goomba.mesh" position="0,0,21" scale=3 pitch=90/>
     
    153163                                        <!--                                    BLOCK 1 in der LUFT - alle analog wie diesen :) -->
    154164                                        <!-- Sobald ein QBlock von unten gehittet wird, wechselt die Visibility von allen attached Models. Hier wuerde also Cube1.1 invisible und Cube2.12 visible. Die Collisionshape wird ja sowieso beibehalten. -->
    155                                         <SOBQBlock collisionType="static" type="Mushroom" position="170,0,20" mass='-1'>                                                                        <!-- L1.1 -->
     165                                        <SOBQBlock collisionType="static" type="Coin" position="170,0,20" mass='-1'>                                                                    <!-- L1.1 -->
    156166                                                <attached>
    157167                                                        <Model mesh="QCube.mesh" scale=10 pitch=90 />
     
    201211                                       
    202212                                        <Model mesh="Cube1.1.mesh" position="250,0,20" scale=10/>                                                                               <!-- L1.7 -->
    203 <!-- Rohre-->
     213                                        <!-- Rohre-->
    204214                                        <Model mesh="Rohr.mesh" position="295,5,-35" scale=10 pitch=90 />                                                               <!-- L1.8 -->
    205215                                        <Model mesh="Rohr.mesh" position="395,5,-25" scale=10 pitch=90 />                                                               <!-- L1.9 -->
     
    244254                                                <collisionShapes>
    245255                                                       
    246                
     256
    247257                                                        <BoxCollisionShape position="295,0,-4" halfExtents="12,5,12" />                                                 <!-- 1.8 -->
    248258                                                        <BoxCollisionShape position="395,0,1" halfExtents="12,5,17" />                                          <!-- 1.9 -->
     
    523533
    524534
    525 
    526                                        
    527 
    528 
    529                                        
     535                                       
     536                                        <!-- FLAG -->
     537                                        <SOBFlagstone points = 100  position="1990,0,10" collisionType="static">
     538                                                <collisionShapes>
     539                                                        <BoxCollisionShape position="0,0,0" halfExtents="5,5,5" />
     540                                                </collisionShapes>
     541                                        </SOBFlagstone>
     542                                        <SOBFlagstone points = 200  position="1990,0,20" collisionType="static">
     543                                                <collisionShapes>
     544                                                        <BoxCollisionShape position="0,0,0" halfExtents="5,5,5" />
     545                                                </collisionShapes>
     546                                        </SOBFlagstone>
     547                                        <SOBFlagstone points = 400  position="1990,0,30" collisionType="static">
     548                                                <collisionShapes>
     549                                                        <BoxCollisionShape position="0,0,0" halfExtents="5,5,5" />
     550                                                </collisionShapes>
     551                                        </SOBFlagstone>
     552                                        <SOBFlagstone points = 800  position="1990,0,40" collisionType="static">
     553                                                <collisionShapes>
     554                                                        <BoxCollisionShape position="0,0,0" halfExtents="5,5,5" />
     555                                                </collisionShapes>
     556                                        </SOBFlagstone>
     557                                        <SOBFlagstone points = 1600  position="1990,0,50" collisionType="static">
     558                                                <collisionShapes>
     559                                                        <BoxCollisionShape position="0,0,0" halfExtents="5,5,5" />
     560                                                </collisionShapes>
     561                                        </SOBFlagstone>
     562                                        <SOBFlagstone points = 2200  position="1990,0,60" collisionType="static">
     563                                                <collisionShapes>
     564                                                        <BoxCollisionShape position="0,0,0" halfExtents="5,5,5" />
     565                                                </collisionShapes>
     566                                        </SOBFlagstone>
     567                                        <SOBFlagstone points = 2700  position="1990,0,70" collisionType="static">
     568                                                <collisionShapes>
     569                                                        <BoxCollisionShape position="0,0,0" halfExtents="5,5,5" />
     570                                                </collisionShapes>
     571                                        </SOBFlagstone>
     572                                        <SOBFlagstone points = 3400  position="1990,0,80" collisionType="static">
     573                                                <collisionShapes>
     574                                                        <BoxCollisionShape position="0,0,0" halfExtents="5,5,5" />
     575                                                </collisionShapes>
     576                                        </SOBFlagstone>
     577                                        <SOBFlagstone points = 4000  position="1990,0,90" collisionType="static">
     578                                                <collisionShapes>
     579                                                        <BoxCollisionShape position="0,0,0" halfExtents="5,5,5" />
     580                                                </collisionShapes>
     581                                        </SOBFlagstone>
     582
     583
     584
     585                                        <SOBCastlestone position="2060,0,-10" collisionType="static">
     586                                                <collisionShapes>
     587                                                        <BoxCollisionShape position="0,0,0" halfExtents="5,5,5" />
     588                                                </collisionShapes>
     589                                        </SOBCastlestone>
     590
     591                                        <SOBCastlestone position="2050,40,-10" collisionType="static">
     592                                                <collisionShapes>
     593                                                        <BoxCollisionShape position="0,0,0" halfExtents="5,5,5" />
     594                                                </collisionShapes>
     595                                        </SOBCastlestone>
     596                                        <StaticEntity collisionType="static" mass='-1'>
     597                                                <collisionShapes>
     598                                                        <BoxCollisionShape position="2050,20,-20" halfExtents="5,20,5" />
     599                                                </collisionShapes>
     600                                        </StaticEntity>
     601
     602
    530603
    531604
     
    563636                                                        <BoxCollisionShape position="1890,0,50" halfExtents="15,5,5" />
    564637                                                        <BoxCollisionShape position="1895,0,60" halfExtents="10,5,5" />
    565                                                         <BoxCollisionShape position="1990,0,40" halfExtents="5,5,55" />
    566 
     638                                                        <!--<BoxCollisionShape position="1990,0,40" halfExtents="5,5,55" />
     639-->
    567640
    568641                                                       
  • code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/CMakeLists.txt

    r11412 r11416  
    1010  SOBGumba.cc
    1111  SOBFlagstone.cc
     12  SOBCastlestone.cc
     13  SOBCoin.cc
    1214
    1315)
  • code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.cc

    r11412 r11416  
    2121 *
    2222 *   Author:
    23  *      Fabian 'x3n' Landau
     23 *      Julien Kindle
    2424 *   Co-authors:
    25  *      ...
     25 *     
    2626 *
    2727 */
    2828
    2929/**
    30     @file Pong.cc
    31     @brief Implementation of the Pong class.
     30    @file SOB.cc
     31    @brief Implementation of the SOB class.
    3232*/
    3333
    3434#include "SOB.h"
    35 
    3635#include "core/CoreIncludes.h"
    3736#include "core/EventIncludes.h"
     
    3938#include "core/config/ConfigValueIncludes.h"
    4039#include "core/Game.h"
    41 
    4240#include "gamestates/GSLevel.h"
    4341#include "chat/ChatManager.h"
    4442#include "infos/PlayerInfo.h"
    45 
    4643#include "SOBCenterpoint.h"
    47 
    4844#include "SOBFigure.h"
    4945#include "graphics/Camera.h"
     46
     47
    5048
    5149namespace orxonox
     
    8987    }
    9088
     89
     90
    9191    void SOB::start()
    9292    {
     
    9595            if (figure_ == nullptr)
    9696            {
    97                 figure_ = new SOBFigure(center_->getContext());
     97                figure_ = new SOBFigure(center_->getContext());     //add a new instance of a player to the game
    9898                figure_->addTemplate(center_->getFigureTemplate());
    99                // figure_->InitializeAnimation(center_->getContext()); //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    10099            }
    101100
     
    124123        cleanup();
    125124        GSLevel::startMainMenu();
    126 
    127125        Deathmatch::end();
    128126    }
     
    131129        cleanup();
    132130
    133         // HACK
     131        // HACK - only method I found to simply reload the level
    134132        Game::getInstance().popState();
    135133        Game::getInstance().popState();
     
    144142        if (figure_->getPlayer() == nullptr)
    145143        {
    146             player->startControl(figure_);
     144            player->startControl(figure_); //Give the control of the instance player to the real person
    147145            players_[player].state_ = PlayerState::Alive;
    148146        }
     
    165163        SUPER(SOB, tick, dt);
    166164
    167         if (this->figure_ != nullptr && figure_->dead_) {
     165        //If player has reached end of level
     166        if (this->figure_ != nullptr && figure_->lvlEnded_) {
     167            std::stringstream a;
     168            a << "Nice! " << getPoints() << " Points. Press <Space> to restart";
     169            info_ =a.str();
     170
     171        //If player has died
     172        } else if (this->figure_ != nullptr && figure_->dead_) {
    168173            info_ = "Game over. Press <Space> to restart";
    169             orxout() << "DEED" << endl;
    170174        }
    171175       
    172176
     177        //Kill the player if time is up
     178        if (this->figure_ != nullptr && timeLeft_ <= 0)
     179            this->figure_->dead_ = true;
     180        //The time on the HUD
    173181        timeLeft_-=dt*2.5;
    174182    }
  • code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.h

    r11412 r11416  
    2121 *
    2222 *   Author:
    23  *      Fabian 'x3n' Landau
     23 *      Julien Kindle
    2424 *   Co-authors:
    25  *      ...
     25 *     
    2626 *
    2727 */
    2828
    2929/**
    30     @file Pong.h
    31     @brief Declaration of the Pong class.
    32     @ingroup Pong
     30    @file SOB.h
     31    @brief Declaration of the SOB class.
    3332*/
    3433
     
    3736
    3837#include "superorxobros/SOBPrereqs.h"
    39 
    40 #include "tools/Timer.h"
    41 
    4238#include "gametypes/Deathmatch.h"
    4339#include "SOBCenterpoint.h"
     
    4541namespace orxonox
    4642{
    47 
    4843
    4944    class _SOBExport SOB : public Deathmatch
     
    6358
    6459            void restart();
     60
     61            //Functions for points and coins
    6562            int getPoints() {
    6663                return points_;
     
    7976                points_+=100;
    8077            }
     78            void addPoints(int poi) {
     79                points_+=poi;
     80            }
    8181            int getTimeLeft() {
    8282                return timeLeft_;
     
    8686            }
    8787           
     88
     89
     90            //Not used yet - placed if somebody wants to develop lvl 1-2 etc
    8891            void setLvl(int lvl) {
    8992                lvl_ = lvl;
     
    109112            int coins_;
    110113            float timeLeft_;
    111        
     114
    112115            int lvl_;
    113116            std::string info_;
     
    117120    }
    118121
    119 #endif /* _Pong_H__ */
     122#endif /* _SOB_H__ */
  • code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCenterpoint.cc

    r11381 r11416  
    2121 *
    2222 *   Author:
    23  *      Fabien Vultier
     23 *      Julien Kindle
    2424 *   Co-authors:
    25  *      ...
     25 *     
    2626 *
    2727 */
     
    2929/**
    3030    @file SOBCenterpoint.cc
    31     @brief The SOBCenterpoint is a StaticEntity which represents the level of the minigame. All platforms, enemies and items are attached to the SOBCenterpoint.
     31    @brief The SOBCenterpoint is a StaticEntity which represents the level of the minigame.
    3232*/
    3333
     
    4545    {
    4646        RegisterObject(SOBCenterpoint);
    47 
    48      
    49 
    5047        checkGametype();
    5148    }
     
    5653
    5754     
     55       
    5856        XMLPortParam(SOBCenterpoint, "cameraOffset", setCameraOffset, getCameraOffset, xmlelement, mode);
    5957       
  • code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCenterpoint.h

    r11392 r11416  
    2121 *
    2222 *   Author:
    23  *      Fabien Vultier
     23 *      Julien Kindle
    2424 *   Co-authors:
    25  *      ...
     25 *     
    2626 *
    2727 */
     
    3838    /**
    3939    @brief
    40         @brief The SOBCenterpoint is a StaticEntity which represents the level of the minigame. All platforms, enemies and items are attached to the SOBCenterpoint.
     40        @brief The SOBCenterpoint is a StaticEntity which represents the level of the minigame. Everybody used it so I used it too, do not ask my why..
    4141    */
    4242    class _SOBExport SOBCenterpoint : public StaticEntity
  • code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.cc

    r11412 r11416  
    2121 *
    2222 *   Author:
    23  *      Fabien Vultier
     23 *      Julien Kindle
    2424 *   Co-authors:
    25  *      ...
     25 *     
    2626 *
    2727 */
     
    4444#include "SOB.h"
    4545#include "SOBFlagstone.h"
     46#include "SOBCastlestone.h"
    4647
    4748namespace orxonox
     
    5455
    5556        // initialize variables
    56 
     57        gravityAcceleration_ = 350.0;
     58
     59        //Vars for movement of player
    5760        moveUpPressed_ = false;
    5861        moveDownPressed_ = false;
     
    6063        moveDownPressed_ = false;
    6164        firePressed_ = false;
     65       
     66        //Times and turning
    6267        timeSinceLastFire_ = 0.0;
    6368        lastSpeed_z = 0.0;
     69        pitch_ = 0.0;
     70        timeCounter_ = 0;
     71
     72        //Properties of player
     73        gotPowerUp_ = false;
    6474        isColliding_ = true;
    6575        particlespawner_ = NULL;
    6676
    67         gravityAcceleration_ = 350.0;
    68         pitch_ = 0.0;
    69 
     77        //Properties of players life
    7078        predead_ = false;
    7179        dead_ = false;
    72         gotPowerUp_ = false;
     80        lvlEnded_ = false;
     81        reachedLvlEndState_ = 0;
     82
    7383       
    74         setAngularFactor(0.0);
    75         this->enableCollisionCallback();
     84        setAngularFactor(0.0); //Means player doesn't turn on collision, so he doesn't fall over while walking over the ground
     85        this->enableCollisionCallback(); // Turns on that on every collision function collidesAgainst is executed
    7686    }
    7787
     
    8191
    8292        isColliding_ = true;
     93
     94        //Orxocast returns object with casted type if otherObject has that class, and if not a nullptr
    8395        SOBMushroom* mush = orxonox_cast<SOBMushroom*>(otherObject);
    8496        SOBGumba* gumba = orxonox_cast<SOBGumba*>(otherObject);
    8597        SOBFlagstone* flagstone = orxonox_cast<SOBFlagstone*>(otherObject);
    86 
     98        SOBCastlestone* castlestone = orxonox_cast<SOBCastlestone*>(otherObject);
     99
     100        //Check if otherObject is a powerup
    87101        if (mush != nullptr && !(mush->hasCollided_)) {
    88102            otherObject->destroyLater();
    89103            gotPowerUp_ = true;
    90             SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
    91             SOBGame->addMushroom();
    92             mush->hasCollided_ = true;
    93 
     104            SOB* SOBGame = orxonox_cast<SOB*>(getGametype()); //Get the Gametype
     105            SOBGame->addMushroom(); // Tell the gametype to increase points
     106            mush->hasCollided_ = true; // needed because of destroyLater takes some time and player should receive points only once
     107
     108        //Check if otherObject is a Gumba (that walking enemies)
    94109        } else if (gumba != nullptr && !(gumba->hasCollided_)) {
    95110
     111            //If player jumps on its head, kill it, else, kill the player
    96112            if (getVelocity().z >= -20) {
    97113              Vector3 vel = getVelocity();
     
    100116              setVelocity(vel);
    101117              predead_=true;
     118
    102119          } else {
    103120            gumba->destroyLater();
     
    110127    }
    111128
    112      if (flagstone != nullptr && !(flagstone->hasCollided_)) {
    113             flagstone->hasCollided_ = true;
    114 
    115      }
     129    //Purpose is that if player hits the flag, he should walk into the castle at the end of the level. For that we use SOBCastlestone
     130    if (reachedLvlEndState_ == 0 && flagstone != nullptr && !(flagstone->hasCollided_)) {
     131        flagstone->hasCollided_ = true;
     132        reachedLvlEndState_ = 1;
     133        SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
     134        SOBGame->addPoints(flagstone->getPoints());
     135
     136    }
     137    if (castlestone != nullptr && !(castlestone->hasCollided_)) {
     138        castlestone->hasCollided_ = true;
     139        reachedLvlEndState_++;
     140
     141    }
    116142
    117143    return true;
     
    119145
    120146
    121 
    122 void SOBFigure::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    123 {
    124     SUPER(SOBFigure, XMLPort, xmlelement, mode);
    125 
    126 }
    127 
    128 
     147//Self implemented sign function that returns either 1 or -1 (and never 0)
    129148int SOBFigure::sgn(float x) {
    130 
    131149    if (x < 0.0) return -1;
    132150    return 1;
    133151}
    134152
     153//For those of you who don't have an idea: the tick function is called about 50 times/sec
    135154void SOBFigure::tick(float dt)
    136155{
    137156    SUPER(SOBFigure, tick, dt);
    138157
     158
     159    bool inputAllowed = true;
     160
     161    //the particle spawner that generates the fire from the backpack when pressed
    139162    if (particlespawner_ == NULL) {
    140163        for (WorldEntity* object : this->getAttachedObjects())
    141164        {
    142          if (object->isA(Class(ParticleSpawner)))
     165           if (object->isA(Class(ParticleSpawner)))
    143166            particlespawner_ = object;
    144 
    145     }
    146 
    147 }
    148 
    149 
    150 
    151 
    152 
    153 
    154 if (firePressed_ == false) {
    155  gravityAcceleration_ = 350.0;
    156 
    157 }
    158 
    159 if (hasLocalController())
    160 {
    161   Vector3 velocity = getVelocity();
    162   Vector3 position = getPosition();
    163 
    164   if (!predead_)
    165     velocity.y = 0;
    166 if (position.z < -100) {
    167     dead_ = true;
    168 
    169 }
    170 
    171 if (dead_) {
    172     velocity.x = 0;
    173     velocity.z = 0;
    174     setVelocity(velocity);
    175     SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
    176     if (firePressed_)
    177         SOBGame->restart();
    178     return;
    179 }
    180 
    181 
    182 int maxvelocity_x = 100;
    183 int speedAddedPerTick = 5;
    184 int camMaxOffset = 25;
    185 
    186 timeSinceLastFire_ += dt;
    187 lastSpeed_z = velocity.z;
     167        }
     168    }
     169
     170
     171    //Behavior on level end - this is like described above for the movement from the player when hit the flag. He moves then into the castle
     172    if (reachedLvlEndState_ != 0) {
     173        timeCounter_+= dt;
     174        inputAllowed = false;
     175    }
     176    if (reachedLvlEndState_ == 1 && timeCounter_ >= 1.5) {
     177        timeCounter_ = 0;
     178        reachedLvlEndState_ = 2;
     179    }
     180
     181
     182    //if input blocked, then cancel every movement operation
     183    if (!inputAllowed) {
     184        moveUpPressed_ = false;
     185        moveDownPressed_ = false;
     186        moveLeftPressed_ = false;
     187        moveRightPressed_ = false;
     188    }
     189
     190    //set the gravityto standard 350
     191    if (firePressed_ == false) {
     192        gravityAcceleration_ = 350.0;
     193
     194    }
     195
     196    if (hasLocalController())
     197    {
     198        Vector3 velocity = getVelocity();
     199        Vector3 position = getPosition();
     200
     201        if (!predead_)
     202            velocity.y = 0;
     203        if (position.z < -100) {
     204            dead_ = true;
     205        }
     206
     207
     208        if (dead_) {
     209            velocity.x = 0;
     210            velocity.z = 0;
     211            setVelocity(velocity);
     212            SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
     213            if (firePressed_)
     214                SOBGame->restart();
     215            return;
     216        }
     217
     218
     219        int maxvelocity_x = 100;
     220        int speedAddedPerTick = 5;
     221        int camMaxOffset = 25;
     222
     223        timeSinceLastFire_ += dt;
     224        lastSpeed_z = velocity.z;
    188225
    189226
    190227
    191228        //Handle the rocket fire from the jetpack
    192 if (velocity.z > 40)
    193     particlespawner_->setVisible(true);
    194 else
    195     particlespawner_->setVisible(false);
     229        if (velocity.z > 40)
     230            particlespawner_->setVisible(true);
     231        else
     232            particlespawner_->setVisible(false);
     233
    196234
    197235        //If player hits space and does not move in z-dir
    198 if (firePressed_ && isColliding_ && std::abs(velocity.z) < 0.1 && std::abs(lastSpeed_z) < 0.1) {
    199     gravityAcceleration_ = 100.0;
     236        if (inputAllowed && firePressed_ && isColliding_ && std::abs(velocity.z) < 0.1 && std::abs(lastSpeed_z) < 0.1) {
     237            gravityAcceleration_ = 100.0;
    200238            velocity.z = 110; //150
    201239        }
    202 
    203       // rotate(1,getOrientation()* WorldEntity::FRONT)
    204240
    205241
    206242        //Left-right movement with acceleration
    207243        float rot = getOrientation().getRoll().valueDegrees();
    208         orxout() << rot << endl;
    209244        if (moveRightPressed_) {
    210245            if (!(rot < 5.0 && -5.0 < rot))
    211246                setOrientation(Vector3::UNIT_Z, getOrientation().getRoll() - sgn(rot)*dt*Radian(6));
    212 
    213247
    214248            if (std::abs(velocity.x) < maxvelocity_x) {
     
    230264
    231265
     266        //Again another EndOfLevel behavior
     267        if (reachedLvlEndState_ == 1)
     268            velocity.x = -2;
     269        if (reachedLvlEndState_ == 2)
     270            velocity.x = 30;
     271        if (reachedLvlEndState_ == 3) {
     272            velocity.x = 0;
     273            velocity.y = 20;
     274        }
     275        if (reachedLvlEndState_ == 4) {
     276            lvlEnded_ = true;
     277            dead_ = true;
     278        }
     279
     280        //velocity = acc. * time
    232281        velocity.z -= gravityAcceleration_*dt;
    233282        setVelocity(velocity);
    234283
    235284
    236         //Camera operation
     285        //Camera operation - the camera should always follow the player in a specific region
    237286        Camera* cam = getCamera();
    238287        Vector3 campos = cam->getPosition();
     
    252301    }
    253302
    254         // Move through the left and right screen boundaries
    255 
    256         //setPosition(position);
    257 
    258         // Reset key variables
     303
     304
     305    // Reset key variables
    259306    moveUpPressed_ = false;
    260307    moveDownPressed_ = false;
    261308    moveLeftPressed_ = false;
    262309    moveRightPressed_ = false;
    263     moveDownPressed_ = false;
     310
    264311    isColliding_ = false;
    265312
     
    270317
    271318
    272 
     319//The following functions read the input of the player and then set the bools for the movement
    273320void SOBFigure::moveFrontBack(const Vector2& value)
    274321{
     
    299346}
    300347
    301 
    302 
    303 
    304 
    305348void SOBFigure::boost(bool boost)
    306349{
    307350    firePressed_ = boost;
    308351}
    309 }
     352
     353
     354}
  • code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.h

    r11412 r11416  
    2121 *
    2222 *   Author:
    23  *      Fabien Vultier
     23 *      Julien Kindle
    2424 *   Co-authors:
    25  *      ...
     25 *     
    2626 *
    2727 */
     
    4141            SOBFigure(Context* context); //!< Constructor. Registers and initializes the object.
    4242            virtual ~SOBFigure() {}
    43             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4443            virtual void tick(float dt) override;
    4544            virtual void moveFrontBack(const Vector2& value) override; //!< Overloaded the function to steer the figure up and down.
    4645            virtual void moveRightLeft(const Vector2& value) override; //!< Overloaded the function to steer the figure up and down.
    47            
    48 
    4946            virtual void boost(bool boost) override;
    5047            virtual  bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
    5148
    52 
    53             //virtual void CollisionWithEnemy(SOBEnemy* enemy);
    54            
    55            
    56 
    57 
    5849            bool dead_;
    5950            bool predead_;
     51            bool lvlEnded_;
    6052
    6153        private:
    6254
     55            //Soooo many declarations
    6356            bool gotPowerUp_;
    6457            bool moveUpPressed_;
     
    7568            WorldEntity* particlespawner_;
    7669            int sgn(float x);
     70            int reachedLvlEndState_;
     71            float timeCounter_;
    7772
    7873
  • code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFlagstone.cc

    r11412 r11416  
    2121 *
    2222 *   Author:
    23  *      Fabien Vultier
     23 *      Julien
    2424 *   Co-authors:
    25  *      ...
     25 *     
    2626 *
    2727 */
     
    2929/**
    3030    @file SOBFlagstone.cc
    31     @brief All items in this minigame inherit from this class. Items can move around like platforms and enemies.
     31    @brief The flagstone, as described in the h file
    3232*/
    3333
     
    4444    RegisterClass(SOBFlagstone);
    4545
    46     SOBFlagstone::SOBFlagstone(Context* context) : MovableEntity(context)
     46    SOBFlagstone::SOBFlagstone(Context* context) : StaticEntity(context)
    4747    {
    4848        RegisterObject(SOBFlagstone);
     
    5050        setAngularFactor(0.0);
    5151        this->enableCollisionCallback();
    52        
     52        
    5353        hasCollided_=false;
    5454       
    55        
     55        
    5656    }
    5757
     
    6464
    6565
    66      }
     66    }
    6767
    68    
     68    
    6969    bool SOBFlagstone::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) {
    7070
    71 
    72 
    73 orxout() << "Watshc bum baem" << otherObject->getMass()<< endl;
    74 return true;
     71        return true;
    7572    }
    7673
    7774
    78  
     75   
    7976
    8077
    81    
     78    
    8279}
  • code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFlagstone.h

    r11412 r11416  
    2121 *
    2222 *   Author:
    23  *      Fabien Vultier
     23 *      Julien Kindle
    2424 *   Co-authors:
    25  *      ...
     25 *     
    2626 *
    2727 */
     
    2929/**
    3030    @file SOBFlagstone.h
    31     @brief Declaration of the SOBFlagstone class.
     31    @brief Declaration of the SOBFlagstone class. This class is used for the flag - for everz 10x10x10 stone we added a flagstone with different points. The higher you touch the flag, the more points you get.
    3232    @ingroup SOB
    3333*/
     
    3737
    3838#include "superorxobros/SOBPrereqs.h"
    39 #include "worldentities/MovableEntity.h"
     39#include "worldentities/StaticEntity.h"
    4040
    4141
    4242namespace orxonox
    4343{
    44     class _SOBExport SOBFlagstone : public MovableEntity
     44    class _SOBExport SOBFlagstone : public StaticEntity
    4545    {
    4646        public:
  • code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBGumba.cc

    r11412 r11416  
    2121 *
    2222 *   Author:
    23  *      Fabien Vultier
     23 *      Julien Kindle
    2424 *   Co-authors:
    25  *      ...
     25 *     
    2626 *
    2727 */
     
    7676    bool SOBGumba::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) {
    7777
    78 
     78        //Every object with mass -1 does not change the direction of the Gumba. For example the ground floor! The other objects switch the direction of the gumba.
    7979        if (changeAllowed_ && otherObject->getMass() != -1) {
    8080            goesRight_ = !goesRight_;
     
    9191    }
    9292
    93     void SOBGumba::touchFigure()
    94     {
    9593
    96     }
    9794
    9895    void SOBGumba::tick(float dt)
     
    10299        if (!changeAllowed_) {
    103100            changedOn_+= dt;
    104             if (changedOn_> 200) {
     101            // After a collision, we don't listen for collisions for 200ms - that's because one wall can cause several collisions!
     102            if (changedOn_> 0.200) {
    105103                changeAllowed_ = true;
    106104                changedOn_ = 0.0;
     
    119117        setVelocity(velocity);
    120118
    121 
    122        
    123119        lastPos_ = getPosition();
    124120    }
     
    126122
    127123}
    128 /*
    129  *   ORXONOX - the hottest 3D action shooter ever to exist
    130  *                    > www.orxonox.net <
    131  *
    132  *
    133  *   License notice:
    134  *
    135  *   This program is free software; you can redistribute it and/or
    136  *   modify it under the terms of the GNU General Public License
    137  *   as published by the Free Software Foundation; either version 2
    138  *   of the License, or (at your option) any later version.
    139  *
    140  *   This program is distributed in the hope that it will be useful,
    141  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    142  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    143  *   GNU General Public License for more details.
    144  *
    145  *   You should have received a copy of the GNU General Public License
    146  *   along with this program; if not, write to the Free Software
    147  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    148  *
    149  *   Author:
    150  *      Fabien Vultier
    151  *   Co-authors:
    152  *      ...
    153  *
    154  */
    155 
    156 /**
    157     @file SOBGumba.h
    158     @brief Declaration of the SOBGumba class.
    159     @ingroup SOB
    160 */
    161 
    162 #ifndef _SOBGumba_H__
    163 #define _SOBGumba_H__
    164 
    165 #include "superorxobros/SOBPrereqs.h"
    166 #include "worldentities/MovableEntity.h"
    167 
    168 
    169 namespace orxonox
    170 {
    171     class _SOBExport SOBGumba : public MovableEntity
    172     {
    173     public:
    174         SOBGumba(Context* context);
    175         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    176         virtual void setFigure(SOBFigure* newFigure);
    177         virtual void touchFigure();
    178         virtual  bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
    179         virtual void tick(float dt) override;
    180 
    181        
    182         bool attachedToFigure_;
    183 
    184         void setSpeed(const float speed)
    185         { this->speed_ = speed; }
    186         float getSpeed() const
    187         { return speed_; }
    188 
    189         bool hasCollided_;
    190     protected:
    191         float gravityAcceleration_;
    192         float speed_;
    193         WeakPtr<SOBFigure> figure_;
    194         bool goesRight_;
    195         Vector3 lastPos_;
    196         bool changeAllowed_;
    197         float changedOn_;
    198        
    199     };
    200 }
    201 
    202 #endif /* _SOBGumba_H__ */
  • code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBGumba.h

    r11412 r11416  
    2121 *
    2222 *   Author:
    23  *      Fabien Vultier
     23 *      Julien Kindle
    2424 *   Co-authors:
    25  *      ...
     25 *     
    2626 *
    2727 */
     
    2929/**
    3030    @file SOBGumba.h
    31     @brief Declaration of the SOBGumba class.
     31    @brief Declaration of the SOBGumba class. Gumbas are the enemie mushrooms - pretty sure it's written Goomba but, naaah
    3232    @ingroup SOB
    3333*/
     
    4848            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4949            virtual void setFigure(SOBFigure* newFigure);
    50             virtual void touchFigure();
    5150            virtual  bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
    5251            virtual void tick(float dt) override;
  • code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBHUDInfo.cc

    r11412 r11416  
    2121 *
    2222 *   Author:
    23  *      Florian Zinggeler
     23 *      Julien Kindle
    2424 *
    2525 */
     
    6060        SUPER(SOBHUDInfo, tick, dt);
    6161
     62        //If you have a look at the HUD xml file, you can see there are several elements with different types.
    6263        if (this->SOBGame)
    6364        {
    6465         
    65          // setPosition(Vector2(0.1, 0.65));
    66           if (this->type_ == "Coins") {
    67                 // this->setCaption("Game ends in 30 seconds.\nPress (e)xit / (q)uit to go to the main menu.\nTo restart fly out of the screen!");
    68            
     66          if (this->type_ == "Coins") {           
    6967           
    7068            std::stringstream ss;
     
    9997}
    10098
     99//No idea why, just implement this method
    101100void SOBHUDInfo::changedOwner()
    102101{
  • code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBHUDInfo.h

    r11405 r11416  
    2121 *
    2222 *   Author:
    23  *      Florian Zinggeler
     23 *      Julien Kindle
    2424 *
    2525 */
  • code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBItem.cc

    r11400 r11416  
    2121 *
    2222 *   Author:
    23  *      Fabien Vultier
     23 *      Julien Kindle
    2424 *   Co-authors:
    25  *      ...
     25 *     
    2626 *
    2727 */
     
    2929/**
    3030    @file SOBItem.cc
    31     @brief All items in this minigame inherit from this class. Items can move around like platforms and enemies.
     31    @brief Not sure if ever used
    3232*/
    3333
     
    6767    bool SOBItem::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) {
    6868
    69 //orxout() << "Watshc bum baem" << endl;
    70 return true;
     69        return true;
    7170    }
    7271
     
    7776    }
    7877
    79     void SOBItem::touchFigure()
    80     {
    8178
    82     }
    8379}
  • code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBItem.h

    r11400 r11416  
    2121 *
    2222 *   Author:
    23  *      Fabien Vultier
     23 *      Julien Kindle
    2424 *   Co-authors:
    25  *      ...
     25 *     
    2626 *
    2727 */
     
    4848            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4949            virtual void setFigure(SOBFigure* newFigure);
    50             virtual void touchFigure();
    5150            virtual  bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
    5251
  • code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.cc

    r11412 r11416  
    2121 *
    2222 *   Author:
    23  *      Fabien Vultier
     23 *      Julien Kindle
    2424 *   Co-authors:
    25  *      ...
     25 *     
    2626 *
    2727 */
     
    2929/**
    3030    @file SOBMushroom.cc
    31     @brief All items in this minigame inherit from this class. Items can move around like platforms and enemies.
     31    @brief This is the class for the powerup mushroom
    3232*/
    3333
     
    7777
    7878
    79 if (changeAllowed_ && otherObject->getMass() != -1) {
     79        if (changeAllowed_ && otherObject->getMass() != -1) {
    8080                goesRight_ = !goesRight_;
    8181                changeAllowed_ = false;
    82 }
     82        }
    8383
    84 orxout() << "Watshc bum baem" << otherObject->getMass()<< endl;
    85 return true;
     84        return true;
    8685    }
    8786
     
    9291    }
    9392
    94     void SOBMushroom::touchFigure()
    95     {
    9693
    97     }
    9894
    9995    void SOBMushroom::tick(float dt)
     
    10197        SUPER(SOBMushroom, tick, dt);
    10298
     99        //Exactly like the Gumba class, if collided, turn direction of Mushroom and wait 200ms so we don't get two collisions from the same wall
    103100        if (!changeAllowed_) {
    104101            changedOn_+= dt;
    105             if (changedOn_> 200) {
     102            if (changedOn_> 0.200) {
    106103                changeAllowed_ = true;
    107104                changedOn_ = 0.0;
  • code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.h

    r11412 r11416  
    4848            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4949            virtual void setFigure(SOBFigure* newFigure);
    50             virtual void touchFigure();
    5150            virtual  bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
    5251            virtual void tick(float dt) override;
  • code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBPrereqs.h

    r11412 r11416  
    2121 *
    2222 *   Author:
    23  *      Reto Grieder
     23 *      Julien Kindle
    2424 *   Co-authors:
    25  *      ...
     25 *     
    2626 *
    2727 */
     
    3030@file
    3131@brief
    32     Shared library macros, enums, constants and forward declarations for the pong module
     32    Shared library macros, enums, constants and forward declarations for the SOB module
    3333*/
    3434
     
    6868namespace orxonox
    6969{
    70    /* class Pong;
    71     class PongAI;
    72     class PongBall;
    73     class PongBat;
    74     class PongBot;*/
    7570    class SOBCenterpoint;
    76    
    7771    class SOB;
    7872    class SOBFigure;
     
    8377    class SOBGumba;
    8478    class SOBFlagstone;
    85     /*
    86     class PongScore;*/
     79    class SOBCastlestone;
     80    class SOBCoin;
     81
    8782}
    8883
  • 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     }
  • code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBQBlock.h

    r11405 r11416  
    2121 *
    2222 *   Author:
    23  *      Fabien Vultier
     23 *      Julien Kindle
    2424 *   Co-authors:
    25  *      ...
     25 *     
    2626 *
    2727 */
     
    5353            std::string type_;
    5454            void spawnMushroom();
     55            void spawnCoin();
    5556    };
    5657           
Note: See TracChangeset for help on using the changeset viewer.