Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 30, 2018, 2:48:17 PM (6 years ago)
Author:
patricwi
Message:

Merged Hover

Location:
code/branches/PresentationFS18
Files:
4 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/PresentationFS18

  • code/branches/PresentationFS18/src/modules/hover/CMakeLists.txt

    r11495 r12019  
    22  Hover.cc
    33  HoverShip.cc
    4   HoverWall.cc
    54  HoverOrigin.cc
    65  HoverFlag.cc
    76  TimeHUD.cc
    87  FlagHUD.cc
    9   MazeGenerator.cc
    108)
    119
  • code/branches/PresentationFS18/src/modules/hover/Hover.cc

    r11495 r12019  
    3535
    3636#include "HoverOrigin.h"
    37 #include "HoverWall.h"
    3837#include "HoverFlag.h"
    39 #include "MazeGenerator.h"
    4038#include "core/CoreIncludes.h"
    4139
     
    5957        SUPER(Hover, tick, dt);
    6058
    61         if(this->firstTick_ && this->origin_)
    62         {
    63             this->firstTick_ = false;
    64 
    65             int numCells = this->origin_->getNumCells();
    66             int cellSize = this->origin_->getCellSize();
    67             int cellHeight = this->origin_->getCellHeight();
    68 
    69             MazeGenerator generator(numCells);
    70             generator.generateMaze();
    71             generator.renderMaze();
    72 
    73             int* levelcode = generator.getLevelcode();
    74 
    75             //Outer Walls
    76             for(int i = 0; i<numCells; i++){
    77                 (new HoverWall(origin_->getContext()))->init(0,        i+1,      cellSize, cellHeight, 1);
    78                 (new HoverWall(origin_->getContext()))->init(numCells, i+1,      cellSize, cellHeight, 1);
    79                 (new HoverWall(origin_->getContext()))->init(i+1,      0,        cellSize, cellHeight, 2);
    80                 (new HoverWall(origin_->getContext()))->init(i+1,      numCells, cellSize, cellHeight, 2);
    81             }
    82 
    83             //Generate inner Walls according to levelcode
    84             for(int y=0; y<numCells; y++){
    85                 for(int x=0; x<numCells; x++){
    86                     switch(levelcode[ y * numCells + x ]){
    87                         case 1: (new HoverWall(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 1);
    88                                 break;
    89                         case 3: (new HoverWall(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 1);
    90                         case 2: (new HoverWall(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 0);
    91                         default: break;
    92                     }
    93                 }   
    94             }
    95 
    96             //Generate 5 flags randomly
    97             for ( int i = 0; i < 5; i++ )
    98             {
    99                 HoverFlag* flag = new HoverFlag(origin_->getContext());
    100                 flag->init(rand()%numCells, rand()%numCells, cellSize);
    101                 flags_.push_back(flag);
    102             }
    103 
    104         }//firsttick end
    105 
    106         // Check if ship collided with one of the flags
    107         for ( unsigned int i = 0; i < flags_.size(); i++ ){
    108             if(flags_[i]->getCollided()){
    109                 flags_[i]->destroyLater();
    110                 flags_.erase (flags_.begin()+i);
    111             }
    112         }
    113         numberOfFlags_ = flags_.size();
    11459    }
    11560}
Note: See TracChangeset for help on using the changeset viewer.