Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 12116


Ignore:
Timestamp:
Nov 21, 2018, 12:13:54 PM (5 years ago)
Author:
ottka
Message:

level select in level file

Location:
code/branches/OrxoKart_HS18
Files:
5 edited

Legend:

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

    r12111 r12116  
    4848          numCells="<?lua print(N)?>"
    4949          cellSize="<?lua print(S)?>"
     50          level=1
    5051        />
    5152      </attached>
     
    6667    <SpawnPoint
    6768      team=0
    68      
     69
    6970      position="<?lua print(S*0)?>,40,<?lua print(8*S)?>"
    7071      lookat="0,40,0"
  • code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.cc

    r12111 r12116  
    6363            this->wayPoints = std::vector<OrxoKartTile*>(3, nullptr);
    6464
    65             int n = this->origin_->getNumCells();
    66             int s = this->origin_->getCellSize();
     65            this->n = this->origin_->getNumCells();
     66            this->s = this->origin_->getCellSize();
     67            this->level = this->origin_->getLevel();
    6768            int map_1[] =   {1,1,1,1,1,1,1,1,0,0,0
    6869                            ,1,0,0,0,0,0,0,1,1,1,0
     
    105106
    106107
    107             int *levelcodeArray =  map_1;
     108            int *levelcodeArray =  level==1 ? map_1 : map_2;
    108109
    109110            // int z = 0;
     
    116117                        // tiles.push_back(tile);
    117118                        //++z;
    118                         if ( i == 10 && j == 4 )
    119                             wayPoints.at(0) = tile;
     119                        if (level == 1) {
     120                            //map 1
     121                            if ( i == 10 && j == 4 )
     122                                wayPoints.at(0) = tile;
    120123
    121                         if ( i == 0 && j == 0)
    122                             wayPoints.at(1) = tile;
    123                         if ( i == 10 && j == 7)
    124                             wayPoints.at(2) = tile;
     124                            if ( i == 0 && j == 0)
     125                                wayPoints.at(1) = tile;
     126                            if ( i == 10 && j == 7)
     127                                wayPoints.at(2) = tile;
     128                        }
     129                        else if (level == 2) {
     130                            //map 2
     131                            if ( i == 24 && j == 11 )
     132                                wayPoints.at(0) = tile;
     133
     134                            if ( i == 0 && j == 0)
     135                                wayPoints.at(1) = tile;
     136                            if ( i == 24 && j == 17)
     137                                wayPoints.at(2) = tile;
     138                        }   
    125139                    }
    126140                }   
     
    166180        if(flag_->getCollided()){
    167181            OrxoKartKart* player = flag_->getObjectofCollision();
    168             player->setPosition(Vector3(80*0, 20, 80*8));
     182            if (level == 1)
     183                player->setPosition(Vector3(s*0, 20, s*8));
     184            if (level == 2)
     185                player->setPosition(Vector3(s*0, 20, s*19));
    169186            player->setOrientation(Quaternion(1, 0, 0, 0));   // 0, 0, 0
    170187            player->setVelocity(Vector3(0,0,0));
  • code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.h

    r12111 r12116  
    6767            int numberOfFlags_;
    6868            bool firstTick_;
     69
     70            int s;
     71            int n;
     72            int level;
    6973    };
    7074}
  • code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartOrigin.cc

    r12090 r12116  
    5353        XMLPortParam(OrxoKartOrigin, "numCells", setNumCells, getNumCells, xmlelement, mode);
    5454        XMLPortParam(OrxoKartOrigin, "cellSize", setCellSize, getCellSize, xmlelement, mode);
     55        XMLPortParam(OrxoKartOrigin, "level", setLevel, getLevel, xmlelement, mode);
    5556    }
    5657
  • code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartOrigin.h

    r12090 r12116  
    6161                { return this->cellSize_; }
    6262
     63            inline void setLevel(int level)
     64                { this->level_ = level; }
     65            inline int getLevel() const
     66                { return this->level_; }   
     67
    6368        private:
    6469            void checkGametype();
     
    6671            int numCells_;
    6772            int cellSize_;
     73            int level_;
    6874    };
    6975}
Note: See TracChangeset for help on using the changeset viewer.