Here is the full code:
#include "DarkGDK.h"
int ninegraderY;
int ninegraderX;
void Game();
void Gravity();
void Movement();
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 100 );
dbMakeObjectBox ( 1, 100, 0, 100 );
dbPositionObject ( 1, 0, -21, 0 );
dbColorObject ( 1, dbRgb ( 0, 50, 0 ) );
dbMakeObjectCube ( 2, 10 );
dbPositionObject ( 2, 0, -15, 10 );
dbColorObject ( 2, dbRgb ( 255, 255, 255 ) );
dbPositionCamera ( 0, 10, - 10 );
while ( LoopGDK ( ) )
{
Game();
dbSync ( );
}
return;
}
void Game( void )
{
Gravity();
Movement();
}
void Gravity( void )
{
if ( dbCameraPositionY() > - 10 )
dbPositionCamera ( dbCameraPositionX(), dbCameraPositionY() - 1 , dbCameraPositionZ() );
if ( dbCameraPositionY() < - 10 )
dbPositionCamera ( dbCameraPositionX(), dbCameraPositionY() + 1, dbCameraPositionZ() );
}
void Movement( void )
{
if ( dbLeftKey ( ) )
dbYRotateCamera ( dbCameraAngleY() - 2);
if ( dbRightKey ( ) )
dbYRotateCamera ( dbCameraAngleY() + 2);
if ( dbUpKey ( ) )
{
if ( dbCameraAngleY() == 0 )
dbPositionCamera ( dbCameraPositionX(), dbCameraPositionY(), dbCameraPositionZ() + 1 );
if ( dbCameraAngleY() == 90 )
dbPositionCamera ( dbCameraPositionX() + 1, dbCameraPositionY(), dbCameraPositionZ() );
if ( dbCameraAngleY() < 90 & dbCameraAngleY() > 0 )
{
ninegraderY = 10 - ( dbCameraAngleX() / 10 );
ninegraderX = 10 - ninegraderY;
dbPositionCamera ( dbCameraPositionX() - ninegraderX, dbCameraPositionY(), dbCameraPositionZ() + ninegraderY );
}
}
}
What I want to do with the funktion:
if ( dbUpKey ( ) )
{
if ( dbCameraAngleY() == 0 )
dbPositionCamera ( dbCameraPositionX(), dbCameraPositionY(), dbCameraPositionZ() + 1 );
if ( dbCameraAngleY() == 90 )
dbPositionCamera ( dbCameraPositionX() + 1, dbCameraPositionY(), dbCameraPositionZ() );
if ( dbCameraAngleY() < 90 && dbCameraAngleY() > 0 )
{
100 - dbCameraAngleX() == ninegraderY;
100 - ninegraderY == ninegraderX;
dbPositionCamera ( dbCameraPositionX() - ninegraderX, dbCameraPositionY(), dbCameraPositionZ() + ninegraderY );
}
}
Is just a other way, than just using dbMoveCamera ( laggy ). I wanted the camera only to move at the X- and Z-Position.
Sorry for my bad english.
But thanks for the help anyway