before loop
bool onWayUp=true;
bool jumping=false;
fHeight = dbGetTerrainGroundHeight ( 1, dbCameraPositionX ( ), dbCameraPositionZ ( ) );
in loop
fHeight = dbGetTerrainGroundHeight ( 1, dbCameraPositionX ( ), dbCameraPositionZ ( ) );
if (!jumping) dbPositionCamera ( dbCameraPositionX ( ), fHeight +3.0f, dbCameraPositionZ ( ) );
float j_CameraPositionY = dbCameraPositionY();
if (dbSpaceKey()==1) jumping=true;
if (jumping)
{
if (onWayUp)
{
dbMoveCameraUp(0, 0.3);
}
else
{
dbMoveCameraDown(0, 0.6);
}
if ( j_CameraPositionY > fHeight+7.0f) onWayUp=false;
if ( j_CameraPositionY < fHeight+3.0f)
{
j_CameraPositionY = fHeight+3.0f;
dbPositionCamera(dbCameraPositionX(),j_CameraPositionY,dbCameraPositionZ());
onWayUp=true;
jumping=false;
}
}
this is a bounce that works for me
Game.Love