-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 @@ -13,49 +13,48 @@ FlyGame :: FlyGame( SFCave *p, int w, int h, int diff ) 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(); 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 @@ -14,26 +14,24 @@ GatesGame :: GatesGame( SFCave *p, int w, int h, int diff ) 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; @@ -55,24 +53,26 @@ void GatesGame :: init() 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 ++; 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 @@ -24,25 +24,25 @@ 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 ); 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 @@ -13,26 +13,24 @@ SFCaveGame :: SFCaveGame( SFCave *p, int w, int h, int diff ) 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; @@ -47,24 +45,26 @@ void SFCaveGame :: init() 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 ) |