Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 7, 2018, 11:42:26 AM (5 years ago)
Author:
ottka
Message:

implement module

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.cc

    r12079 r12089  
    6161            this->firstTick_ = false;
    6262
    63             int numCells = this->origin_->getNumCells();
    64             int cellSize = this->origin_->getCellSize();
     63            int n = this->origin_->getNumCells();
     64            int s = this->origin_->getCellSize();
    6565            int cellHeight = this->origin_->getCellHeight();
    6666
     
    7575                                    ,1,1,1,1,1,0,0,0,1,1,1
    7676                                    ,0,0,0,0,1,0,0,0,0,0,1
    77                                     ,0,0,0,0,1,1,1,1,1,1,1};
     77                                    ,0,0,0,0,1,1,1,2,1,1,1};
    7878            int* levelcode = levelcodeArray;
    7979
    80             //Outer Walls
    81             for(int i = 0; i<numCells; i++){
    82                 (new OrxoKartTile(origin_->getContext()))->init(0,        i+1,      cellSize, cellHeight, 1);
    83                 (new OrxoKartTile(origin_->getContext()))->init(numCells, i+1,      cellSize, cellHeight, 1);
    84                 (new OrxoKartTile(origin_->getContext()))->init(i+1,      0,        cellSize, cellHeight, 2);
    85                 (new OrxoKartTile(origin_->getContext()))->init(i+1,      numCells, cellSize, cellHeight, 2);
    86             }
    8780
    88             //Generate inner Walls according to levelcode
    89             for(int y=0; y<numCells; y++){
    90                 for(int x=0; x<numCells; x++){
    91                     switch(levelcode[ y * numCells + x ]){
    92                         case 1: (new OrxoKartTile(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 1);
    93                                 break;
    94                         case 3: (new OrxoKartTile(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 1);
    95                         case 2: (new OrxoKartTile(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 0);
    96                         default: break;
    97                     }
     81            //Generate floor according to levelcode
     82            for(int i=0; i<n; i++){
     83                for(int j=0; j<n; j++){
     84                    if (int type = levelcodeArray[i*n + j])
     85                    (new OrxoKartTile(origin_->getContext()))->init((n-1-i)*s, j*s, s, type);
    9886                }   
    9987            }
Note: See TracChangeset for help on using the changeset viewer.