Changeset 11935 for code/branches/OrxyRoad_FS18/src/modules
- Timestamp:
- May 3, 2018, 3:57:08 PM (7 years ago)
- Location:
- code/branches/OrxyRoad_FS18/src/modules/orxyroad
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/OrxyRoad_FS18/src/modules/orxyroad/OrxyRoad.cc
r11934 r11935 57 57 pattern = 3; 58 58 lastPosition = 0; 59 roadWidth = 3000; 60 61 62 63 64 59 65 // spawn enemy every 3.5 seconds 60 66 //enemySpawnTimer.setTimer(3.5f, true, createExecutor(createFunctor(&OrxyRoad::spawnEnemy, this))); … … 88 94 showLevelTimer.setTimer(1.0f, false, createExecutor(createFunctor(&OrxyRoad::toggleShowLevel, this))); 89 95 } 96 int OrxyRoad::generateStreet(int type, OrxyRoadShip* player){ 97 int trafficVelocities[]= {20,1000,500, 200}; 98 int numObjects[] = {60,10,40,60}; // default, spaceship, sattellite, asteroid 99 int streetSize[] = {3 , 1, 2, 4}; 100 int trackWidth = 800; 101 102 for(int j = 0; j < streetSize[type]; j++)//width of Street 103 { 104 for(int i = -numObjects[type]/2; i<numObjects[type]/2; i++) 105 { 106 OrxyRoadCube* cube = new OrxyRoadCube(this->center_->getContext()); 107 cubeList.push_back(cube); 108 switch(type) 109 { 110 case 0 : cube->addTemplate("SingleOrxyRoadCube");//default 111 break; 112 case 1: 113 114 cube->addTemplate("SingleOrxyRoadCube");//spaceship 115 116 break; 117 case 2: cube->addTemplate("SingleOrxyRoadCube");//satellite 118 break; 119 case 3: cube->addTemplate("SingleOrxyRoadCube");//asteroid 120 121 } 122 123 int distance = trafficVelocities[type]; //Todo better calculation of distance between objects 124 125 cube->setPosition(player->getWorldPosition() + Vector3(1000.0f+j*trackWidth, 0.0f, i*600.0f+j*trackWidth)); 126 127 /* experimental */ 128 129 cube->setVelocity(0,0,trafficVelocities[type]); 130 131 /* experimental */ 132 133 134 //stEntity->setScale3D(50,50,50); 135 } 136 } 137 return streetSize[type] * trackWidth; 138 } 139 140 141 90 142 91 143 void OrxyRoad::tick(float dt) … … 111 163 } 112 164 165 166 167 113 168 if(counter >= 3000) 114 169 { 115 counter = 0; 116 for(int j = 0; j < 3; j++)//deepth cube 117 { 118 for(int i = -30; i<30; i++) 119 { 120 OrxyRoadCube* cube = new OrxyRoadCube(this->center_->getContext()); 121 cubeList.push_back(cube); 122 switch(pattern) 123 { 124 case 1: cube->addTemplate("OrxyRoadCube01"); 125 break; 126 case 2: cube->addTemplate("OrxyRoadCube01"); 127 break; 128 case 3: cube->addTemplate("SingleOrxyRoadCube"); 129 130 } 131 132 cube->setPosition(player->getWorldPosition() + Vector3(1000.0f+j*800.0f, 0.0f, i*600.0f+j*300)); 133 134 /* experimental */ 135 136 cube->setVelocity(0,0,500); 137 138 /* experimental */ 139 140 141 //stEntity->setScale3D(50,50,50); 142 } 143 } 144 170 int type = rand() % 4; 171 orxout(user_info) << "Random : "<<type<< endl; 172 173 roadWidth = generateStreet(type,player);//Generate street to specific type type = 0 default, type = 1 space ship type = 2 statellite/cubes, type = 3 asteroids 174 counter = 0; 145 175 146 176 //pattern %= 2; -
code/branches/OrxyRoad_FS18/src/modules/orxyroad/OrxyRoad.h
r11899 r11935 118 118 119 119 120 int generateStreet(int type, OrxyRoadShip* player); 121 int roadWidth; 122 //int trafficVelocities[4]; 123 //int numObjects[4]; 124 //int streetSize[4]; 125 126 120 127 /* 121 128 -
code/branches/OrxyRoad_FS18/src/modules/orxyroad/OrxyRoadShip.cc
r11934 r11935 200 200 steeredLeft = false; 201 201 steeredRight = true; 202 orxout(user_info) << "Steering RIGHT "<<steering_.x << endl;202 //orxout(user_info) << "Steering RIGHT "<<steering_.x << endl; 203 203 }else { 204 204 steeredRight = false; 205 205 steeredLeft = true; 206 orxout(user_info) << "Steering LEFT "<<steering_.x << endl;206 //orxout(user_info) << "Steering LEFT "<<steering_.x << endl; 207 207 208 208 } -
code/branches/OrxyRoad_FS18/src/modules/orxyroad/OrxyRoadShip.h
r11908 r11935 90 90 float y; 91 91 } velocity, desiredVelocity; 92 92 93 93 94 };
Note: See TracChangeset
for help on using the changeset viewer.