Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 16, 2019, 1:13:58 PM (6 years ago)
Author:
pomselj
Message:

BallProjectiles fly

Location:
code/branches/OrxoBlox_FS19/src/modules
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/CMakeLists.txt

    r12367 r12371  
    33  OrxoBlox.cc
    44  OrxoBloxWall.cc
    5   OrxoBloxBall.cc
    65  OrxoBloxCenterpoint.cc
    76  OrxoBloxStones.cc
  • code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc

    r12370 r12371  
    4848
    4949#include "OrxoBloxCenterpoint.h"
    50 #include "OrxoBloxBall.h"
    5150#include "OrxoBloxStones.h"
    5251#include "OrxoBloxWall.h"
     
    6867
    6968        this->center_ = nullptr;
    70         this->ball_ = nullptr;
     69        //this->ball_ = nullptr;
    7170        this->futureWall_ = nullptr;
    7271        this->player_ = nullptr;
     
    7776
    7877        // Pre-set the timer, but don't start it yet.
    79         this->starttimer_.setTimer(1.0, false, createExecutor(createFunctor(&OrxoBlox::startBall, this)));
     78        this->starttimer_.setTimer(1.0, false, createExecutor(createFunctor(&OrxoBlox::LevelUp, this)));
    8079        this->starttimer_.stopTimer();
    8180
     
    10099    void OrxoBlox::cleanup()
    101100    {
    102         if (this->ball_ != nullptr) // Destroy the ball, if present.
    103         {
    104             this->ball_->destroy();
    105             this->ball_ = nullptr;
    106         }
     101        //if (this->ball_ != nullptr) // Destroy the ball, if present.
     102        //{
     103        //    this->ball_->destroy();
     104        //    this->ball_ = nullptr;
     105        //}
    107106
    108107        if (this->futureWall_ != nullptr)
     
    135134        if (this->center_ != nullptr) // There needs to be a OrxoBloxCenterpoint, i.e. the area the game takes place.
    136135        {
    137             if (this->ball_ == nullptr) // If there is no ball, create a new ball.
    138             {
    139                 this->ball_ = new OrxoBloxBall(this->center_->getContext());
     136            //if (this->ball_ == nullptr) // If there is no ball, create a new ball.
     137            //{
     138            //    this->ball_ = new OrxoBloxBall(this->center_->getContext());
    140139                // Apply the template for the ball specified by the centerpoint.
    141                 this->ball_->addTemplate(this->center_->getBalltemplate());
    142             }
     140            //    this->ball_->addTemplate(this->center_->getBalltemplate());
     141            //}
    143142
    144143            // Attach the ball to the centerpoint and set the parameters as specified in the centerpoint, the ball is attached to.
    145             this->center_->attach(this->ball_);
     144            //this->center_->attach(this->ball_);
    146145            //Startposition Ball
    147             this->ball_->setPosition(0, 0, 40);
    148             this->ball_->setFieldDimension(this->center_->getFieldDimension());
    149             this->ball_->setSpeed(0);
    150             this->ball_->setAccelerationFactor(this->center_->getBallAccelerationFactor());
     146            //this->ball_->setPosition(0, 0, 40);
     147            //this->ball_->setFieldDimension(this->center_->getFieldDimension());
     148            //this->ball_->setSpeed(0);
     149            //this->ball_->setAccelerationFactor(this->center_->getBallAccelerationFactor());
    151150           
    152151            level_=1;
     
    286285        Starts the ball with some default speed.
    287286    */
    288     void OrxoBlox::startBall()
    289     {
    290         if (this->ball_ != nullptr && this->center_ != nullptr)
    291             this->ball_->setSpeed(this->center_->getBallSpeed());
    292     }
     287    //void OrxoBlox::startBall()
     288    //{
     289    //    if (this->ball_ != nullptr && this->center_ != nullptr)
     290    //        this->ball_->setSpeed(this->center_->getBallSpeed());
     291    //}
    293292     
    294     OrxoBloxStones* OrxoBlox::CheckForCollision(OrxoBloxBall* Ball) {
    295 
     293    /*OrxoBloxStones* OrxoBlox::CheckForCollision(OrxoBloxBall* Ball) {
    296294        //orxout() << "Checking for Collision" << endl;
    297295        Vector3 BallPosition = Ball->getPosition();
     
    314312        return nullptr;
    315313    }
     314    */
    316315
    317316    void OrxoBlox::playerPreSpawn(PlayerInfo* player)
  • code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.h

    r12370 r12371  
    8989            OrxoBloxCenterpoint* getCenterpoint(void)
    9090                { return this->center_; }
    91             OrxoBloxStones* CheckForCollision(OrxoBloxBall* Ball);
     91            //OrxoBloxStones* CheckForCollision(OrxoBloxBall* Ball);
    9292            virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command
    9393        protected:
     
    9595            void startWall(void);
    9696            void createWall(void);
    97             void startBall(); //!< Starts the ball with some default speed.
     97            //void startBall(); //!< Starts the ball with some default speed.
    9898            void cleanup(); //!< Cleans up the Gametype by destroying the ball and the bats.
    9999
    100100            WeakPtr<OrxoBloxCenterpoint> center_; //!< The playing field.
    101             WeakPtr<OrxoBloxBall> ball_; //!< The OrxoBlox ball.
     101            //WeakPtr<OrxoBloxBall> ball_; //!< The OrxoBlox ball.
    102102            unsigned int level_;
    103103
  • code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxPrereqs.h

    r12370 r12371  
    6969{
    7070    class OrxoBlox;
    71     class OrxoBloxBall;
     71    //class OrxoBloxBall;
    7272    class OrxoBloxCenterpoint;
    7373    class OrxoBloxWall;
  • code/branches/OrxoBlox_FS19/src/modules/weapons/projectiles/BallProjectile.cc

    r12368 r12371  
    3434#include "BallProjectile.h"
    3535#include "../OrxoBlox/OrxoBlox.h"
     36#include "../OrxoBlox/OrxoBloxStones.h"
    3637#include "gametypes/Gametype.h"
    3738
     
    5758        this->maxTextureIndex_ = 8;
    5859        this->setDestroyAfterCollision(false); //I want the ball to bounce, not to be destroyed
     60        this->fieldWidth_ = 46;
     61        this->fieldHeight_ =  49;
    5962        //this->orxoblox_ = this->getOrxoBlox();
    6063
     
    6467    void BallProjectile::registerVariables()
    6568    {
    66         registerVariable( this->fieldWidth_ );
    67         registerVariable( this->fieldHeight_ );
    6869        registerVariable(this->materialBase_);
    6970        registerVariable( this->speed_ );
     
    145146        orxout() << "wanna bounce..." << endl;
    146147        bool result = BasicProjectile::processCollision(otherObject, contactPoint, cs);
    147         Bounce(otherObject, contactPoint, cs);
     148        if (result == true) {
     149            if (otherObject->isA(Class(OrxoBloxStones))) {
     150                Bounce(otherObject, contactPoint, cs);
     151            }
     152        }
    148153        orxout() << "BOUNCED!" << endl;
    149154
     
    175180        Vector3 acceleration = this->getAcceleration();
    176181
     182        velocity.y = 0;
     183        position.y = 0;
     184
    177185        // If the ball has gone over the top or bottom boundary of the playing field (i.e. the ball has hit the top or bottom delimiters).
    178         if (position.z > this->fieldHeight_ / 2 || position.z < -this->fieldHeight_ / 2)
     186        if (position.z > this->fieldHeight_ || position.z < -this->fieldHeight_)
    179187        {
    180188
    181189            velocity.z = -velocity.z;
    182190            // And its position is set as to not overstep the boundary it has just crossed. Remember z axis is reverted!!!
    183             if (position.z > this->fieldHeight_ / 2){
     191            if (position.z > this->fieldHeight_){
    184192                // Set the ball to be exactly at the boundary.
    185                 position.z = this-> fieldHeight_ / 2;
     193                position.z = this-> fieldHeight_;
    186194               
    187195                //orxoblox_->LevelUp();
     
    218226
    219227            }
    220             if (position.z < -this->fieldHeight_ / 2){
    221                 position.z = -this->fieldHeight_ / 2 ;
     228            if (position.z < -this->fieldHeight_){
     229                position.z = -this->fieldHeight_;
    222230               
    223231            }
     
    228236        //Ball hits the right or left wall and should bounce back.
    229237        // If the ball has crossed the left or right boundary of the playing field.
    230         if (position.x > this->fieldWidth_ / 2 || position.x < -this->fieldWidth_ / 2)
     238        if (position.x > this->fieldWidth_ || position.x < -this->fieldWidth_)
    231239        {
    232240            //Ball hits the right Wall
    233             if (position.x > this->fieldWidth_ / 2)
     241            if (position.x > this->fieldWidth_)
    234242                {
    235243                    // Set the ball to be exactly at the boundary.
    236                     position.x = this->fieldWidth_ / 2;
     244                    position.x = this->fieldWidth_;
    237245                    // Invert its velocity in x-direction (i.e. it bounces off).
    238246                    velocity.x = -velocity.x;
     
    241249
    242250            //Ball hits the left wall
    243             else if (position.x < -this->fieldWidth_ / 2)
     251            else if (position.x < -this->fieldWidth_)
    244252                {
    245253                        // Set the ball to be exactly at the boundary.
    246                         position.x = -this->fieldWidth_ / 2;
     254                        position.x = -this->fieldWidth_;
    247255                        // Invert its velocity in x-direction (i.e. it bounces off).
    248256                        velocity.x = -velocity.x;
  • code/branches/OrxoBlox_FS19/src/modules/weapons/weaponmodes/BallGun.cc

    r12281 r12371  
    3434#include "BallGun.h"
    3535
     36
    3637#include "core/CoreIncludes.h"
    3738#include "core/XMLPort.h"
     
    5960        this->reloadTime_ = 0.25f;
    6061        this->damage_ = 0.0f; //default 15
    61         this->speed_ = 750.0f;
    62         this->delay_ = 0.0f;
     62        this->speed_ = 50;
     63        this->delay_ = 100;
    6364        this->setMunitionName("BallMunition");
    6465        this->mesh_ = "laserbeam.mesh";
Note: See TracChangeset for help on using the changeset viewer.