Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 11, 2017, 2:20:57 PM (7 years ago)
Author:
zarron
Message:

Boss spawned Gumbas have now max lifetime

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

Legend:

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

    r11650 r11651  
    6161        changedOn_ = 0.0;
    6262        creator_ = nullptr;
     63        maxLifetime_ = 10;
     64        lifetime_ = 0;
    6365       
    6466    }
     
    111113            changedOn_+= dt;
    112114            // After a collision, we don't listen for collisions for 200ms - that's because one wall can cause several collisions!
    113             if (changedOn_> 0.200) {
     115            if (changedOn_> 0.400) {
    114116                changeAllowed_ = true;
    115117                changedOn_ = 0.0;
     
    134136        lastPos_ = getPosition();
    135137
     138        if (creator_ != nullptr)
     139        {
     140            lifetime_ += dt;
     141            if(lifetime_>maxLifetime_)
     142            {
     143                this->destroyLater();
     144            }
     145        }
     146
    136147    }
    137148}
  • code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumba.h

    r11632 r11651  
    7070            bool changeAllowed_;
    7171            float changedOn_;
     72            float maxLifetime_;
     73            float lifetime_;
    7274
    7375           
Note: See TracChangeset for help on using the changeset viewer.