Changeset 11972 for code/branches/OrxyRoad_FS18/src
- Timestamp:
- May 17, 2018, 3:58:17 PM (6 years ago)
- Location:
- code/branches/OrxyRoad_FS18/src/modules/orxyroad
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/OrxyRoad_FS18/src/modules/orxyroad/OrxyRoad.cc
r11970 r11972 95 95 } 96 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, asteroid97 int trafficVelocities[]= {200,1400,500, 300}; 98 int numObjects[] = {60,100,40,60}; // default, spaceship, sattellite, asteroid per track 99 99 int streetSize[] = {3 , 1, 2, 4}; 100 int trackWidth = 800;100 int trackWidth = 700; 101 101 102 102 for(int j = 0; j < streetSize[type]; j++)//width of Street 103 103 { 104 int sign = rand()%2; 105 106 orxout(internal_error) << sign<< endl; 107 108 109 104 110 for(int i = -numObjects[type]/2; i<numObjects[type]/2; i++) 105 111 { 106 112 OrxyRoadCube* cube = new OrxyRoadCube(this->center_->getContext()); 107 113 cubeList.push_back(cube); 114 int templateType = rand()%2; 108 115 switch(type) 109 116 { 110 case 0 : cube->addTemplate("asteroid");//default 117 case 0 : 118 if(templateType >=1){ 119 cube->addTemplate("asteroid");//default 120 }else { 121 cube->addTemplate("asteroid");//default 122 } 111 123 break; 112 124 case 1: 113 114 cube->addTemplate("spacecruiser");//spaceship 125 if(templateType >=1){ 126 cube->addTemplate("asteroid");//spaceship1 127 }else { 128 cube->addTemplate("spacecruiser");//spaceship2 129 } 130 115 131 116 132 break; 117 case 2: cube->addTemplate("spacecruiser");//satellite 133 case 2: 134 if(templateType >=1){ 135 cube->addTemplate("asteroid");//satellite 136 }else { 137 cube->addTemplate("spacecruiser");//satellite 138 } 139 140 118 141 break; 119 case 3: cube->addTemplate("asteroid");//asteroid 142 case 3: 143 if(templateType >=1){ 144 cube->addTemplate("asteroid");//asteroid 145 }else { 146 cube->addTemplate("spacecruiser");//asteroid 147 } 148 120 149 121 150 } 122 151 123 int distance = trafficVelocities[type] ; //Todo better calculation of distance between objects152 int distance = trafficVelocities[type]*3; //Todo better calculation of distance between objects 124 153 125 cube->setPosition(player->getWorldPosition() + Vector3(1000.0f+j*trackWidth, 0.0f, i* 600.0f+j*trackWidth));154 cube->setPosition(player->getWorldPosition() + Vector3(1000.0f+j*trackWidth, 0.0f, i*distance+j*trackWidth)); 126 155 127 156 /* experimental */ 128 129 cube->setVelocity(0,0,trafficVelocities[type]); 157 158 159 if(sign>=1){ 160 cube->setVelocity(0,0,trafficVelocities[type]); 161 } else{ 162 cube->setVelocity(0,0,-trafficVelocities[type]); 163 } 164 165 166 130 167 131 168 /* experimental */ … … 166 203 167 204 168 if(counter >= 3000)205 if(counter >= roadWidth) 169 206 { 170 207 int type = rand() % 4; -
code/branches/OrxyRoad_FS18/src/modules/orxyroad/OrxyRoadShip.cc
r11935 r11972 82 82 if(velocity.y < 200){// Limit for max velocity 83 83 velocity.y += 10; 84 forward = false; 84 85 } 85 86 … … 91 92 velocity.y = 0; // Prevent players from going backwards 92 93 } 94 backward = false; 93 95 94 96 }else { … … 119 121 120 122 if(steeredLeft){ 121 velocity.x += 100; 122 steeredLeft = false; 123 if(!forward){ 124 velocity.x += 5; 125 steeredLeft = false; 126 } 127 123 128 124 129 }else if(steeredRight) { 125 velocity.x += -100; 126 steeredRight = false; 130 if(!forward){ 131 velocity.x += -5; 132 steeredRight = false; 133 } 127 134 }else { 128 135 if(velocity.x < -2 || velocity.x > 2 ){ … … 206 213 //orxout(user_info) << "Steering LEFT "<<steering_.x << endl; 207 214 208 } 209 215 } 210 216 211 217 //lastTimeLeft = 0;
Note: See TracChangeset
for help on using the changeset viewer.