summaryrefslogtreecommitdiff
path: root/noncore/games/sfcave-sdl/fly_game.cpp
Side-by-side diff
Diffstat (limited to 'noncore/games/sfcave-sdl/fly_game.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/sfcave-sdl/fly_game.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/noncore/games/sfcave-sdl/fly_game.cpp b/noncore/games/sfcave-sdl/fly_game.cpp
index f5ab401..7605c3f 100644
--- a/noncore/games/sfcave-sdl/fly_game.cpp
+++ b/noncore/games/sfcave-sdl/fly_game.cpp
@@ -14,12 +14,13 @@ FlyGame :: FlyGame( SFCave *p, int w, int h, int diff )
player = new Player( w, h );
highScore = 0;
}
FlyGame :: ~FlyGame()
{
+ // terrain and player get deleted by parent class
}
void FlyGame :: init()
{
Game :: init();
@@ -31,12 +32,21 @@ void FlyGame :: init()
case MENU_DIFFICULTY_NORMAL:
player->setMovementInfo( 0.35, 0.4, 2.5, 3 );
break;
case MENU_DIFFICULTY_HARD:
player->setMovementInfo( 0.4, 0.6, 4, 5 );
break;
+ case MENU_DIFFICULTY_CUSTOM:
+ {
+ double thrust = parent->loadDoubleSetting( "Fly_custom_player_thrust", 0.3 );
+ double gravity = parent->loadDoubleSetting( "Fly_custom_player_gravity", 0.2 );
+ double maxUp = parent->loadDoubleSetting( "Fly_custom_player_maxupspeed", 1.5 );
+ double maxDown = parent->loadDoubleSetting( "Fly_custom_player_maxdownspeed", 1.5 );
+ player->setMovementInfo( thrust, gravity, maxUp, maxDown );
+ break;
+ }
}
startScoring = false;
}
void FlyGame :: update( int state )
@@ -47,13 +57,13 @@ void FlyGame :: update( int state )
{
if ( nrFrames % 3 == 0 )
{
int diff = terrain->getMapBottom( 10 ) - player->getY();
int tmpScore = ((FlyTerrain *)terrain)->getScore( 1, diff );
-// printf( "diff - %d score - %d\n", diff, tmpScore );
+
if ( !startScoring )
{
if ( tmpScore > 0 )
startScoring = true;
}
@@ -66,13 +76,12 @@ void FlyGame :: update( int state )
score += tmpScore;
}
}
if ( checkCollisions() )
{
-// printf( "Crashed!\n" );
parent->changeState( STATE_CRASHING );
return;
}
// Game logic goes here
terrain->moveTerrain( 5 );