Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11543


Ignore:
Timestamp:
Nov 6, 2017, 4:18:11 PM (6 years ago)
Author:
pascscha
Message:

camera changes

Location:
code/branches/FlappyOrx_HS17
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FlappyOrx_HS17/data/levels/templates/spaceshipFlappyOrx.oxt

    r11529 r11543  
    8686      <CameraPosition position="0,20, 90" drag=true mouselook=true />
    8787      <CameraPosition position="0,30,120" drag=true mouselook=true /> -->
    88       <CameraPosition position="0,300,-100" direction="0, -1, 0" drag=false mouselook=true />
     88      <CameraPosition position="0,300,-100" direction="0, -1, 0" drag=false absolute=true mouselook=true />
    8989    </camerapositions>
    9090  </FlappyOrxShip>
  • code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.cc

    r11537 r11543  
    6969        {
    7070            if(getHealth()<0){
    71                  getGame()->costLife();
    72                  getGame()->death();
    73                  death();
     71                setHealth(1);
     72                getGame()->death();
     73                death();   
    7474            }
    7575            Vector3 pos = getPosition();
     
    8787            pos += Vector3(speed + velocity.x, 0, velocity.y) * dt;
    8888           
    89             if(pos.z > 150){
    90                 pos.z=0;
    91                 velocity.y = 0;
    92             }
    93            
    94             // restart if game ended
    95             if (getGame())
    96                 if (getGame()->bEndGame)
    97                 {
    98                     getGame()->start();
    99                     return;
    100                 }
    101            
     89
    10290           
    10391            // Camera
     
    10593            if (camera != nullptr)
    10694            {
    107                 camera->setPosition(Vector3(-pos.z, -pos.y, 0));
    108                 camera->setOrientation(Vector3::UNIT_Z, Degree(90));
     95                //camera->setPosition(Vector3(-pos.z, -pos.y, 0));
     96                camera->setPosition(pos.x,-100,0);
     97                camera->setOrientation(Vector3::UNIT_Z, Degree(0));
     98
    10999            }
    110100
    111101           
    112102            setPosition(pos);
    113             setOrientation(Vector3::UNIT_Y, Degree(270));
     103            setOrientation(Vector3::UNIT_Y, Degree(270-velocity.y/10));
     104
     105            if(pos.z > 150){
     106                getGame()->death();
     107                death();
     108            }
    114109           
    115110        }
     
    154149        Vector3 pos = getPosition();
    155150        pos.x = 0;
     151        pos.z = 0;
     152        pos.y = 0;
     153        velocity.y = 0;
    156154        setPosition(pos);
     155        usleep(1000u);
    157156    }
    158157}
Note: See TracChangeset for help on using the changeset viewer.