author | andyq <andyq> | 2002-12-20 17:53:12 (UTC) |
---|---|---|
committer | andyq <andyq> | 2002-12-20 17:53:12 (UTC) |
commit | 3019cddcdb9aca09f463024ac67620c144dbf211 (patch) (side-by-side diff) | |
tree | a4f41d9db95d254ea8e46a21742b0272c764b3be /noncore | |
parent | fdcb16419ebc646875a1c2cc4e9f623af502a31d (diff) | |
download | opie-3019cddcdb9aca09f463024ac67620c144dbf211.zip opie-3019cddcdb9aca09f463024ac67620c144dbf211.tar.gz opie-3019cddcdb9aca09f463024ac67620c144dbf211.tar.bz2 |
Added difficultie levels to SFCave game type
-rw-r--r-- | noncore/games/sfcave/sfcave.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/noncore/games/sfcave/sfcave.cpp b/noncore/games/sfcave/sfcave.cpp index 929dc41..5633a8f 100644 --- a/noncore/games/sfcave/sfcave.cpp +++ b/noncore/games/sfcave/sfcave.cpp @@ -5,25 +5,25 @@ #ifdef QWS #include <qpe/qpeapplication.h> #include <qpe/config.h> #else #include <qapplication.h> #endif #include <qdir.h> #include "helpwindow.h" #include "sfcave.h" -#define CAPTION "SFCave 1.11 by AndyQ" +#define CAPTION "SFCave 1.12 by AndyQ" #define UP_THRUST 0.6 #define NO_THRUST 0.8 #define MAX_DOWN_THRUST 4.0 #define MAX_UP_THRUST -3.5 // States #define STATE_BOSS 0 #define STATE_RUNNING 1 #define STATE_CRASHING 2 #define STATE_CRASHED 3 #define STATE_NEWGAME 4 @@ -218,56 +218,66 @@ int SFCave :: nextInt( int range ) return val; } void SFCave :: setUp() { score = 0; offset = 0; nrFrames = 0; dir = 1; thrust = 0; + int dist[] = { 100, 60, 40 }; if ( CURRENT_GAME_TYPE == SFCAVE_GAME ) { thrustUp = UpThrustVals[SFCAVE_GAME_TYPE][currentGameDifficulty];; noThrust = DownThrustVals[SFCAVE_GAME_TYPE][currentGameDifficulty];; maxUpThrust = MaxUpThrustVals[SFCAVE_GAME_TYPE][currentGameDifficulty];; maxDownThrust = MaxDownThrustVals[SFCAVE_GAME_TYPE][currentGameDifficulty];; + + if ( currentCameDifficulty == DIFICULTY_EASY ) + gateDistance = 100; + else if ( currentCameDifficulty == DIFICULTY_EASY ) + gateDistance = 60; + else + gateDistance = 40; + + printf( "GD = %d\n", gateDistance ); } else if ( CURRENT_GAME_TYPE == GATES_GAME ) { thrustUp = UpThrustVals[GATES_GAME_TYPE][currentGameDifficulty];; noThrust = DownThrustVals[GATES_GAME_TYPE][currentGameDifficulty];; maxUpThrust = MaxUpThrustVals[GATES_GAME_TYPE][currentGameDifficulty];; maxDownThrust = MaxDownThrustVals[GATES_GAME_TYPE][currentGameDifficulty];; + gateDistance = 75; + nextGate = nextInt( 50 ) + gateDistance; } else { thrustUp = UpThrustVals[FLY_GAME_TYPE][currentGameDifficulty]; noThrust = DownThrustVals[FLY_GAME_TYPE][currentGameDifficulty]; maxUpThrust = MaxUpThrustVals[FLY_GAME_TYPE][currentGameDifficulty]; maxDownThrust = MaxDownThrustVals[FLY_GAME_TYPE][currentGameDifficulty]; } crashLineLength = 0; lastGateBottomY = 0; user.setRect( 50, sWidth/2, 4, 4 ); blockWidth = 20; blockHeight = 70; gapHeight = initialGateGaps[currentGameDifficulty]; - gateDistance = 75; - nextGate = nextInt( 50 ) + gateDistance; for ( int i = 0 ; i < TRAILSIZE ; ++i ) { trail[i].setX( -1 ); trail[i].setY( 0 ); } if ( CURRENT_GAME_TYPE != FLY_GAME ) { maxHeight = 50; mapTop[0] = (int)(nextInt(50)) + 5; @@ -359,25 +369,25 @@ void SFCave :: handleGameSFCave() if ( nrFrames % 500 == 0 ) { if ( maxHeight < sHeight - 100 ) { maxHeight += 10; // Reduce block height if ( maxHeight > sHeight - 150 ) blockHeight -= 5; } } - if ( nrFrames % 100 == 0 ) + if ( nrFrames % gateDistance == 0 ) addBlock(); if ( checkCollision() ) { if ( score > highestScore[currentGameType][currentGameDifficulty] ) { highestScore[currentGameType][currentGameDifficulty] = score; saveScore(); } state = STATE_CRASHING; } else |