-rw-r--r-- | noncore/games/sfcave-sdl/fly_game.cpp | 3 | ||||
-rw-r--r-- | noncore/games/sfcave-sdl/gates_game.cpp | 4 | ||||
-rw-r--r-- | noncore/games/sfcave-sdl/player.cpp | 2 | ||||
-rw-r--r-- | noncore/games/sfcave-sdl/sfcave_game.cpp | 4 |
4 files changed, 6 insertions, 7 deletions
diff --git a/noncore/games/sfcave-sdl/fly_game.cpp b/noncore/games/sfcave-sdl/fly_game.cpp index 7605c3f..8b05d8f 100644 --- a/noncore/games/sfcave-sdl/fly_game.cpp +++ b/noncore/games/sfcave-sdl/fly_game.cpp @@ -9,57 +9,56 @@ FlyGame :: FlyGame( SFCave *p, int w, int h, int diff ) { gameName = "Fly"; difficulty = MENU_DIFFICULTY_EASY; terrain = new FlyTerrain( w, h ); player = new Player( w, h ); highScore = 0; } FlyGame :: ~FlyGame() { // terrain and player get deleted by parent class } void FlyGame :: init() { - Game :: init(); - switch( difficulty ) { case MENU_DIFFICULTY_EASY: player->setMovementInfo( 0.3, 0.2, 1.5, 1.5 ); break; 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; + Game :: init(); } void FlyGame :: update( int state ) { Game::update( state ); if ( state == STATE_PLAYING ) { if ( nrFrames % 3 == 0 ) { int diff = terrain->getMapBottom( 10 ) - player->getY(); int tmpScore = ((FlyTerrain *)terrain)->getScore( 1, diff ); if ( !startScoring ) { diff --git a/noncore/games/sfcave-sdl/gates_game.cpp b/noncore/games/sfcave-sdl/gates_game.cpp index 762801d..700a6ec 100644 --- a/noncore/games/sfcave-sdl/gates_game.cpp +++ b/noncore/games/sfcave-sdl/gates_game.cpp @@ -10,34 +10,32 @@ GatesGame :: GatesGame( SFCave *p, int w, int h, int diff ) gameName = "Gates"; difficulty = MENU_DIFFICULTY_EASY; blockUpdateRate = 200; terrain = new Terrain( w, h ); player = new Player( w, h ); highScore = 0; } GatesGame :: ~GatesGame() { // terrain and player get deleted by parent class } void GatesGame :: init() { - Game :: init(); - blockHeight = 80; blockWidth = 20; lastGateBottomY = 0; gateDistance = 75; nextGate = nextInt( 50 ) + gateDistance; gapHeight = 75; switch( difficulty ) { case MENU_DIFFICULTY_EASY: gapHeight = 75; player->setMovementInfo( 0.4, 0.6, 4, 5 ); break; case MENU_DIFFICULTY_NORMAL: gapHeight = 50; @@ -51,32 +49,34 @@ void GatesGame :: init() { // Read custom difficulty settings for this game gapHeight = parent->loadIntSetting( "Gates_custom_gapHeight", 75 ); double thrust = parent->loadDoubleSetting( "Gates_custom_player_thrust", 0.4 ); double gravity = parent->loadDoubleSetting( "Gates_custom_player_gravity", 0.6 ); double maxUp = parent->loadDoubleSetting( "Gates_custom_player_maxupspeed", 4.0 ); double maxDown = parent->loadDoubleSetting( "Gates_custom_player_maxdownspeed", 5.0 ); player->setMovementInfo( thrust, gravity, maxUp, maxDown ); break; } } for ( int i = 0 ; i < BLOCKSIZE ; ++i ) blocks[i].y( -1 ); + + Game :: init(); } void GatesGame :: update( int state ) { Game::update( state ); // Game logic goes here if ( state == STATE_PLAYING ) { if ( nrFrames % 3 == 0 ) score ++; if ( nrFrames % 500 == 0 ) { if ( gapHeight > 75 ) gapHeight -= 5; diff --git a/noncore/games/sfcave-sdl/player.cpp b/noncore/games/sfcave-sdl/player.cpp index 2d52ae2..f024d6b 100644 --- a/noncore/games/sfcave-sdl/player.cpp +++ b/noncore/games/sfcave-sdl/player.cpp @@ -20,33 +20,33 @@ Player :: Player( int w, int h ) init(); } Player :: ~Player() { if ( explosion ) delete explosion; } void Player :: init() { // Set player position pos.x( 50 ); pos.y( sWidth/2 ); pos.h( 2 ); pos.w( 4 ); - thrust = 0; + currentThrust = 0; crashing = false; crashLineLength = 0; crashed = false; explosion->reset(); allFaded = false; expNextFrame = false; // Reset Trail for ( int i = 0 ; i < TRAILSIZE ; ++i ) { trail[i].x( -1 ); trail[i].y( 0 ); trail[i].w( 2 ); trail[i].h( 2 ); } } diff --git a/noncore/games/sfcave-sdl/sfcave_game.cpp b/noncore/games/sfcave-sdl/sfcave_game.cpp index 1b00e14..8fdbbe5 100644 --- a/noncore/games/sfcave-sdl/sfcave_game.cpp +++ b/noncore/games/sfcave-sdl/sfcave_game.cpp @@ -9,66 +9,66 @@ SFCaveGame :: SFCaveGame( SFCave *p, int w, int h, int diff ) { gameName = "SFCave"; difficulty = MENU_DIFFICULTY_EASY; blockUpdateRate = 200; terrain = new Terrain( w, h ); player = new Player( w, h ); highScore = 0; } SFCaveGame :: ~SFCaveGame() { } void SFCaveGame :: init() { - Game :: init(); - blockDistance = 50; blockHeight = 80; blockWidth = 20; switch( difficulty ) { case MENU_DIFFICULTY_EASY: blockDistance = 50; break; case MENU_DIFFICULTY_NORMAL: blockDistance = 40; break; case MENU_DIFFICULTY_HARD: blockDistance = 30; break; case MENU_DIFFICULTY_CUSTOM: { // Read custom difficulty settings for this game blockDistance = parent->loadIntSetting( "SFCave_custom_blockdistance", 50 ); double thrust = parent->loadDoubleSetting( "SFCave_custom_player_thrust", 0.4 ); double gravity = parent->loadDoubleSetting( "SFCave_custom_player_gravity", 0.6 ); double maxUp = parent->loadDoubleSetting( "SFCave_custom_player_maxupspeed", 4.0 ); double maxDown = parent->loadDoubleSetting( "SFCave_custom_player_maxdownspeed", 5.0 ); player->setMovementInfo( thrust, gravity, maxUp, maxDown ); break; } } for ( int i = 0 ; i < BLOCKSIZE ; ++i ) blocks[i].y( -1 ); + + Game :: init(); } void SFCaveGame :: update( int state ) { Game::update( state ); if ( state == STATE_PLAYING ) { if ( nrFrames % 3 == 0 ) score ++; if ( nrFrames % 200 == 0 ) { if ( terrain->getMaxHeight() < sHeight - 100 ) { terrain->increaseMaxHeight( 10 ); |