Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 11, 2017, 2:14:15 PM (7 years ago)
Author:
varxth
Message:

better than evver

Location:
code/branches/SOBv2_HS17/src/modules/superorxobros
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc

    r11628 r11650  
    115115        SOBMushroom*    mush        = orxonox_cast<SOBMushroom*>    (otherObject);
    116116        SOBGumba*       gumba       = orxonox_cast<SOBGumba*>       (otherObject);
    117         SOBGumbaBoss*   gumbaBoss   = orxonox_cast<SOBGumbaBoss*>       (otherObject);
     117        SOBGumbaBoss*   gumbaBoss   = orxonox_cast<SOBGumbaBoss*>   (otherObject);
    118118        SOBFlagstone*   flagstone   = orxonox_cast<SOBFlagstone*>   (otherObject);
    119119        SOBCastlestone* castlestone = orxonox_cast<SOBCastlestone*> (otherObject);
  • code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFlagstone.h

    r11416 r11650  
    2929/**
    3030    @file SOBFlagstone.h
    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.
     31    @brief Declaration of the SOBFlagstone class.
     32            This class is used for the flag - for every 10x10x10 stone we added a flagstone with different points. The higher you touch the flag, the more points you get.
    3233    @ingroup SOB
    3334*/
  • code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumba.cc

    r11629 r11650  
    124124
    125125        Vector3 velocity = getVelocity();
     126        if(velocity.z > -1 && velocity.z < 1)
     127        {
     128            velocity.x = dir*speed_;
     129        }     
     130
    126131        velocity.z -= gravityAcceleration_*dt;
    127         velocity.x = dir*speed_;
    128132        setVelocity(velocity);
    129133
  • code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumbaBoss.cc

    r11647 r11650  
    3131    @file SOBGumbaBoss.cc
    3232    @brief A Boss Gumba, which shoots small Gumbas
    33 */
     33**/
    3434
    3535#include "SOB.h"
     
    5454        RegisterObject(SOBGumbaBoss);
    5555
    56         gumbaMaxTime_ = 1;
    57         gumbaTime_ = 0;
    58         maxGumbas = 2; //Max Gumbas spawnable by a Boss
     56        gumbaMaxTime_   = 1;
     57        gumbaTime_      = 0;
     58        maxGumbas_      = 10; //Max Gumbas spawnable by a Boss
     59        jumpTime_       = 0;
     60        jumpTimeMax_    = 5;
    5961       
    6062    }
     
    6365    bool SOBGumbaBoss::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) {
    6466
     67        SOBGumba*       gumba       = orxonox_cast<SOBGumba*>(otherObject);
     68        SOBGumbaBoss*   gumbaBoss   = orxonox_cast<SOBGumbaBoss*>(otherObject);
     69
     70        if (gumba != nullptr && gumbaBoss == nullptr && !(gumba->hasCollided_)) {
     71            gumba->destroyLater();
     72            gumba->hasCollided_ = true;
     73        }
     74
     75
    6576        //Every object with mass -1 does not change the direction of the GumbaBoss. For example the ground floor! The other objects switch the direction of the GumbaBoss.
    66         if (changeAllowed_ && otherObject->getMass() != -1) {
     77        else if (changeAllowed_ && otherObject->getMass() != -1) {
    6778            goesRight_ = !goesRight_;
    6879            changeAllowed_ = false;
     
    7889    {
    7990        SUPER(SOBGumbaBoss, tick, dt);
     91        gumbaTime_ += dt;
     92        jumpTime_  += dt;
    8093
    8194        if (!changeAllowed_) {
     
    89102        }
    90103   
    91         gumbaTime_ += dt;
    92104
    93105        if(gumbaTime_ > gumbaMaxTime_){ //Spawn Gumba
     
    103115
    104116
    105             if(gumbaCounter<maxGumbas){    //only maxGumbas are allowed at one time per Gumbaboss
     117            if(gumbaCounter<maxGumbas_){    //only maxGumbas are allowed at one time per Gumbaboss
    106118                spawnGumba();
    107119                gumbaTime_ = 0;
     
    114126
    115127        Vector3 velocity = getVelocity();
    116         velocity.z -= gravityAcceleration_*dt;
     128        if(jumpTime_ > jumpTimeMax_){
     129            velocity.z = speed_*15;
     130            jumpTime_ = 0;
     131        }
     132        else{
     133            velocity.z -= gravityAcceleration_*dt;
     134        }
     135
    117136        velocity.x = dir*speed_;
    118137        setVelocity(velocity);
     
    132151        {
    133152            gumba->addTemplate("gumbaShootable");
    134             bool direction = ((this->getWorldOrientation().getRoll().valueRadians())>-1.6&&(this->getWorldOrientation().getRoll().valueRadians()<1.6));
    135             gumba->setDirection(direction);
    136             if(direction)
     153            gumba->setDirection(goesRight_);
     154            if(goesRight_)
    137155            {
    138156                spawnpos.x+=20;
     
    148166
    149167        Vector3 velocity = gumba->getVelocity();
    150         velocity.z -= 100;
     168        velocity.x += (2*goesRight_ -1) * 100;
     169        velocity.z += 200;
    151170        gumba->setVelocity(velocity);
    152171     }
  • code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumbaBoss.h

    r11629 r11650  
    5656            float gumbaTime_;
    5757            float gumbaMaxTime_;
    58             int maxGumbas;
     58            float jumpTimeMax_;
     59            float jumpTime_;
     60            int maxGumbas_;
     61
    5962
    6063           
Note: See TracChangeset for help on using the changeset viewer.