Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 20, 2017, 3:21:35 PM (6 years ago)
Author:
varxth
Message:

merged Fireball and player

File:
1 edited

Legend:

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

    r11573 r11575  
    6767        collDisX_ = 0;
    6868        collDisZ_ = 0;
    69 
    70       orxout() << "fireball existed" << endl;
    71 
     69        hitCounter_ = 0;
    7270       
    7371    }
     
    9088        SOBGumba* gumba = orxonox_cast<SOBGumba*>(otherObject);
    9189
     90
    9291        if(gumba!=nullptr && !(gumba->hasCollided_)) //if other object is a Gumba, kill the Gumba and add score and destroy the fireball
    9392        {
     
    9998            this->hasCollided_ = true;
    10099        }
     100
     101
    101102         //collision with either top or bottom of a block
    102103        else if(changeAllowed_ && (abs(collDisX_)<=abs(collDisZ_)))
     
    104105            changeAllowed_ = false;
    105106            Vector3 velocity = getVelocity();
    106             orxout() << "before:    velocity in z = " << velocity.z << endl;
    107107            velocity.z = -velocity.z;
    108             orxout() << "after:     velocity in z = " << velocity.z << endl;
     108     
    109109
    110110            setVelocity(velocity);
     
    114114        else if(changeAllowed_ && (abs(collDisX_)>abs(collDisZ_)))
    115115        {
    116             orxout() << "collision with the vertical side of a block " << endl;
    117 
    118116            changeAllowed_ = false;
    119117            goesRight_=!goesRight_;
    120118        }
    121119
     120        hitCounter_++;
    122121       
    123122        return true;
     
    154153            velocity.x = dir*speed_;
    155154            velocity.y = 0;
     155            if(hitCounter_ >= 3) velocity.y = 50;
    156156            setVelocity(velocity);
    157157
    158158            lastPos_ = getPosition();
     159
     160            if(abs(this->getPosition().z) > 1000) delete this;
    159161       
    160162    }
Note: See TracChangeset for help on using the changeset viewer.