Changeset 12019 for code/branches/PresentationFS18/src/modules
- Timestamp:
- May 30, 2018, 2:48:17 PM (6 years ago)
- Location:
- code/branches/PresentationFS18
- Files:
-
- 4 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/PresentationFS18
- Property svn:mergeinfo changed
/code/branches/Hover_FS18 (added) merged: 11821,11892,11909,11971,11995,12008,12010-12011
- Property svn:mergeinfo changed
-
code/branches/PresentationFS18/src/modules/hover/CMakeLists.txt
r11495 r12019 2 2 Hover.cc 3 3 HoverShip.cc 4 HoverWall.cc5 4 HoverOrigin.cc 6 5 HoverFlag.cc 7 6 TimeHUD.cc 8 7 FlagHUD.cc 9 MazeGenerator.cc10 8 ) 11 9 -
code/branches/PresentationFS18/src/modules/hover/Hover.cc
r11495 r12019 35 35 36 36 #include "HoverOrigin.h" 37 #include "HoverWall.h"38 37 #include "HoverFlag.h" 39 #include "MazeGenerator.h"40 38 #include "core/CoreIncludes.h" 41 39 … … 59 57 SUPER(Hover, tick, dt); 60 58 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 Walls76 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 levelcode84 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 randomly97 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 end105 106 // Check if ship collided with one of the flags107 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();114 59 } 115 60 }
Note: See TracChangeset
for help on using the changeset viewer.