Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11985


Ignore:
Timestamp:
May 24, 2018, 2:39:49 PM (6 years ago)
Author:
jacobsr
Message:

distance variation between obejcts\

File:
1 edited

Legend:

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

    r11975 r11985  
    9696    int OrxyRoad::generateStreet(int type, OrxyRoadShip* player){
    9797        int trafficVelocities[]= {200,1400,500, 300};
    98         int numObjects[] = {60,100,40,60}; // default, spaceship, sattellite, asteroid per track
     98        int velocityVariation[] = {40,80,100,20};
     99        int numObjects[] = {60,40,30,40}; // default, spaceship, sattellite, asteroid per track
    99100        int streetSize[] = {3 , 1, 2, 4};
    100101        int trackWidth = 700;
     
    104105                int sign = rand()%2;
    105106
    106                 orxout(internal_error) << sign<< endl;
     107                //orxout(internal_error) << sign<< endl;
    107108               
    108109               
     
    150151                        }
    151152
    152                         int distance = trafficVelocities[type]*3; //Todo better calculation of distance between objects
     153                        int posVar = rand()%2;
     154                        int distance = trafficVelocities[type]*3 +posVar*trafficVelocities[type]/10; //Todo better calculation of distance between objects
    153155                       
    154                         cube->setPosition(player->getWorldPosition() + Vector3(1000.0f+j*trackWidth, 0.0f, i*distance+j*trackWidth));
     156                        cube->setPosition(player->getWorldPosition() + Vector3(2000.0f+j*trackWidth, 0.0f, i*distance));
    155157                       
    156158                        /* experimental */
     
    158160
    159161                        if(sign>=1){
    160                             cube->setVelocity(0,0,trafficVelocities[type]);
     162                            cube->setVelocity(0,0,trafficVelocities[type]*level+velocityVariation[j%3]);
    161163                        } else{
    162                              cube->setVelocity(0,0,-trafficVelocities[type]);
     164                             cube->setVelocity(0,0,-trafficVelocities[type]*level+velocityVariation[j%3]);
    163165                        }
    164166                       
     
    193195            for(unsigned int i=0; i < cubeList.size();i++)
    194196            {
    195                 if(cubeList.at(i)->getPosition().x < currentPosition-3000)
     197                if(cubeList.at(i)->getPosition().x < currentPosition-500)
    196198                {
    197199                    cubeList.at(i)->destroy();
     
    203205
    204206
    205             if(counter >= roadWidth)
     207            if(counter >= roadWidth-200)
    206208            {
    207209                int type  = rand() % 4;
Note: See TracChangeset for help on using the changeset viewer.