Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 4, 2017, 3:36:20 PM (6 years ago)
Author:
zarron
Message:

Boss now working

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

Legend:

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

    r11567 r11629  
    6060        changeAllowed_ = true;
    6161        changedOn_ = 0.0;
     62        creator_ = nullptr;
    6263       
    6364    }
     
    9192    }
    9293
    93 
     94    void SOBGumba::setDirection(const bool direction)
     95    {
     96        if(direction)
     97        {
     98            goesRight_=true;
     99        }
     100        else
     101        {
     102            goesRight_=false;
     103        }
     104    }
    94105
    95106    void SOBGumba::tick(float dt)
  • code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumba.h

    r11416 r11629  
    5151            virtual void tick(float dt) override;
    5252
     53            void setDirection(const bool direction);
    5354         
    5455            bool attachedToFigure_;
     
    6869            bool changeAllowed_;
    6970            float changedOn_;
     71            SOBGumbaBoss* creator_;
    7072           
    7173    };
  • code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumbaBoss.cc

    r11628 r11629  
    5454        RegisterObject(SOBGumbaBoss);
    5555
    56         gumbaMaxTime_ = 5;
     56        gumbaMaxTime_ = 4;
    5757        gumbaTime_ = 0;
     58        maxGumbas = 10; //Max Gumbas spawnable by a Boss
    5859       
    5960    }
    60 
    61 
    6261
    6362   
     
    9392
    9493        if(gumbaTime_ > gumbaMaxTime_){
    95             spawnFireball();
     94            spawnGumba();
    9695            gumbaTime_ = 0;
    9796        }
     
    109108
    110109    }
    111     void SOBGumbaBoss::spawnFireball() {
     110    void SOBGumbaBoss::spawnGumba() {
    112111        SOBCenterpoint* center_ = ((SOB*)getGametype())->center_;
    113112
    114          SOBFireball* ball = new SOBFireball(center_->getContext());
     113         SOBGumba* gumba = new SOBGumba(center_->getContext());
    115114         Vector3 spawnpos = this->getWorldPosition();
    116115         spawnpos.z += 0;
    117116
    118         if (ball != nullptr && center_ != nullptr)
     117        if (gumba != nullptr && center_ != nullptr)
    119118        {
    120             ball->addTemplate("fireball");
     119            gumba->addTemplate("gumbaShootable");
    121120            bool direction = ((this->getWorldOrientation().getRoll().valueRadians())>-1.6&&(this->getWorldOrientation().getRoll().valueRadians()<1.6));
    122             ball->setDirection(direction);
     121            gumba->setDirection(direction);
    123122            if(direction)
    124123            {
    125                 spawnpos.x+=10;
     124                spawnpos.x+=20;
    126125            }
    127126            else
    128127            {
    129                 spawnpos.x-=10;
     128                spawnpos.x-=20;
    130129            }
    131             ball->setPosition(spawnpos);
     130            spawnpos.z+=15;
     131            gumba->setPosition(spawnpos);
    132132
    133133        }
    134134
    135         Vector3 velocity = ball->getVelocity();
     135        Vector3 velocity = gumba->getVelocity();
    136136        velocity.z -= 100;
    137         ball->setVelocity(velocity);
     137        gumba->setVelocity(velocity);
    138138     }
    139139}
  • code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumbaBoss.h

    r11623 r11629  
    5050            virtual void tick(float dt) override;
    5151
    52             void spawnFireball();
     52            void spawnGumba();
    5353
    5454
     
    5656            float gumbaTime_;
    5757            float gumbaMaxTime_;
     58            int maxGumbas;
     59
    5860           
    5961    };
Note: See TracChangeset for help on using the changeset viewer.