Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 17, 2018, 3:58:17 PM (6 years ago)
Author:
jacobsr
Message:

changed control, traffic distance, randomly choose type and template

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/OrxyRoad_FS18/src/modules/orxyroad/OrxyRoad.cc

    r11970 r11972  
    9595    }
    9696    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
     97        int trafficVelocities[]= {200,1400,500, 300};
     98        int numObjects[] = {60,100,40,60}; // default, spaceship, sattellite, asteroid per track
    9999        int streetSize[] = {3 , 1, 2, 4};
    100         int trackWidth = 800;
     100        int trackWidth = 700;
    101101     
    102102        for(int j = 0; j < streetSize[type]; j++)//width of Street
    103103            {
     104                int sign = rand()%2;
     105
     106                orxout(internal_error) << sign<< endl;
     107               
     108               
     109
    104110                for(int i = -numObjects[type]/2; i<numObjects[type]/2; i++)
    105111                {
    106112                        OrxyRoadCube* cube = new OrxyRoadCube(this->center_->getContext());
    107113                        cubeList.push_back(cube);
     114                        int templateType = rand()%2;
    108115                        switch(type)
    109116                        {
    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                            }
    111123                        break;
    112124                        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                           
    115131
    116132                        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                           
    118141                        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
    120149
    121150                        }
    122151
    123                         int distance = trafficVelocities[type]; //Todo better calculation of distance between objects
     152                        int distance = trafficVelocities[type]*3; //Todo better calculation of distance between objects
    124153                       
    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));
    126155                       
    127156                        /* 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                       
    130167
    131168                        /* experimental */
     
    166203
    167204
    168             if(counter >= 3000)
     205            if(counter >= roadWidth)
    169206            {
    170207                int type  = rand() % 4;
Note: See TracChangeset for help on using the changeset viewer.