Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 21, 2018, 9:32:15 AM (6 years ago)
Author:
ottka
Message:

implement simple respawn

Location:
code/branches/OrxoKart_HS18
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/OrxoKart_HS18/data/levels/OrxoKart1.oxw

    r12090 r12108  
    1919<?lua
    2020--number of tiles
    21 N = 11
     21N = 25
    2222--scaling factor
    2323S = 80
     
    6565    <SpawnPoint
    6666      team=0
    67       position="<?lua print(S*0)?>,40,<?lua print(8*S)?>"
     67      position="<?lua print(S*0)?>,40,<?lua print(19*S)?>"
    6868      lookat="0,40,0"
    6969      spawnclass=OrxoKartKart
  • code/branches/OrxoKart_HS18/src/modules/orxokart/CMakeLists.txt

    r12074 r12108  
    44  OrxoKartTile.cc
    55  OrxoKartOrigin.cc
     6  OrxoKartFlag.cc
    67  TimeHUD.cc
    78)
  • code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.cc

    r12090 r12108  
    3333
    3434#include "OrxoKart.h"
    35 
     35#include "OrxoKartFlag.h"
     36#include "OrxoKartKart.h"
    3637#include "OrxoKartOrigin.h"
    3738#include "OrxoKartTile.h"
     
    4748
    4849        this->origin_ = nullptr;
    49         // this->numberOfFlags_ = 1;
     50        this->numberOfFlags_ = 1;
    5051        this->firstTick_ = true;
    5152
     
    5758        SUPER(OrxoKart, tick, dt);
    5859
     60
    5961        if(this->firstTick_ && this->origin_)
    6062        {
     
    6466            int s = this->origin_->getCellSize();
    6567
    66             int levelcodeArray[] =  {1,1,1,1,1,1,1,1,0,0,0
    67                                     ,1,0,0,0,0,0,0,1,1,1,0
    68                                     ,1,0,1,1,1,1,0,0,0,1,1
    69                                     ,1,1,1,0,0,1,1,0,0,0,1
    70                                     ,0,0,0,0,0,0,1,0,1,1,1
    71                                     ,1,1,1,1,1,1,1,0,1,0,0
    72                                     ,1,0,0,0,0,0,0,0,1,0,0
    73                                     ,1,0,0,0,0,0,0,0,1,0,0
    74                                     ,1,1,1,1,1,0,0,0,1,1,1
    75                                     ,0,0,0,0,1,0,0,0,0,0,1
    76                                     ,0,0,0,0,1,1,1,2,1,1,1};
     68            int map_1[] =   {1,1,1,1,1,1,1,1,0,0,0
     69                            ,1,0,0,0,0,0,0,1,1,1,0
     70                            ,1,0,1,1,1,1,0,0,0,1,1
     71                            ,1,1,1,0,0,1,1,0,0,0,1
     72                            ,0,0,0,0,0,0,1,0,1,1,1
     73                            ,1,1,1,1,1,1,1,0,1,0,0
     74                            ,1,0,0,0,0,0,0,0,1,0,0
     75                            ,1,0,0,0,0,0,0,0,1,0,0
     76                            ,1,1,1,1,1,0,0,0,1,1,1
     77                            ,0,0,0,0,1,0,0,0,0,0,1
     78                            ,0,0,0,0,1,1,1,2,1,1,1};
     79
     80            int map_2[] =  {1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
     81                            1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,
     82                            1,0,1,1,1,1,1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,
     83                            1,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,1,1,1,1,1,1,1,0,0,
     84                            1,0,1,0,1,1,1,1,1,0,1,0,1,0,1,0,0,0,0,0,0,0,1,0,0,
     85                            1,0,1,0,1,0,0,0,1,0,1,0,1,0,1,0,1,1,1,1,1,0,1,0,0,
     86                            1,0,1,0,1,1,1,0,1,0,1,0,1,0,1,0,1,0,0,0,1,0,1,0,0,
     87                            1,0,1,0,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,1,0,1,0,0,
     88                            1,0,1,1,1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,0,1,0,0,
     89                            1,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0,1,0,1,1,1,1,1,0,0,
     90                            1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,
     91                            0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,
     92                            0,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,1,
     93                            0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,0,0,1,
     94                            0,1,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,1,0,0,0,0,0,0,1,
     95                            0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,1,
     96                            0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,
     97                            0,1,0,1,1,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,
     98                            0,1,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,
     99                            0,1,0,1,0,1,0,0,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,
     100                            0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
     101                            0,1,0,1,0,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,
     102                            0,1,1,1,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,
     103                            0,0,0,0,0,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,1,1,1,0,1,
     104                            0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,2,1,1,1,0,1,1,1};
     105
     106
     107
     108            int *levelcodeArray =  map_2;
    77109
    78110
     
    85117            }
    86118
     119            //bottom flag
     120           
     121                OrxoKartFlag* flag = new OrxoKartFlag(origin_->getContext());
     122                flag->init(n, s);
     123                flag_ = flag;
     124           
     125
     126
    87127           
    88128
    89129        }//firsttick end
    90             /*
    91         // Check if ship collided with one of the flags
    92         for ( unsigned int i = 0; i < flags_.size(); i++ ){
    93             if(flags_[i]->getCollided()){
    94                 flags_[i]->destroyLater();
    95                 flags_.erase (flags_.begin()+i);
    96             }
     130
     131       
     132           
     133        // Check if ship collided with the flag
     134        if(flag_->getCollided()){
     135            OrxoKartKart* player = flag_->getObjectofCollision();
     136            orxout() << "Orientation= " << player->getOrientation() << endl;
     137            player->setPosition(Vector3(80*0, 40, 80*18));
     138            player->setOrientation(Quaternion(1, 0, 0, 0));   // 0, 0, 0
     139            player->setVelocity(Vector3(0,0,0));
     140            player->setAcceleration(Vector3(0,0,0));
     141            flag_->setCollided(false);
     142
     143
     144            // flag_->destroyLater();
     145           // flags_.erase (flags_.begin()+i);
     146            numberOfFlags_ = 0;
    97147        }
    98         numberOfFlags_ = flags_.size(); */
    99148       
    100149    }
  • code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.h

    r12074 r12108  
    5555                { this->origin_ = origin; }
    5656
    57             /*inline int getNumberOfFlags() const
    58                 { return this->numberOfFlags_; }*/
     57            inline int getNumberOfFlags() const
     58                { return this->numberOfFlags_; }
    5959
    6060        private:
    6161            WeakPtr<OrxoKartOrigin> origin_;
     62            OrxoKartFlag* flag_;
    6263            //std::vector<OrxoKartFlag*> flags_;
    63             //int numberOfFlags_;
     64            int numberOfFlags_;
    6465            bool firstTick_;
    6566    };
  • code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartPrereqs.h

    r12057 r12108  
    6969{
    7070    class OrxoKart;
     71    class OrxoKartFlag;
    7172    class OrxoKartOrigin;
    7273    class OrxoKartKart;
  • code/branches/OrxoKart_HS18/src/modules/orxokart/TimeHUD.cc

    r12074 r12108  
    8282        {
    8383            this->setCaption(getTimeString(this->time_));
    84             //if (this->orxokartGame_->getNumberOfFlags() == 0)
    85               //  setRunning(false);
     84            if (this->orxokartGame_->getNumberOfFlags() == 0)
     85                setRunning(false);
    8686        }
    8787       
Note: See TracChangeset for help on using the changeset viewer.