--- froggix/src/froggix.c 2009/04/07 04:16:45 1.4 +++ froggix/src/froggix.c 2009/04/22 03:54:22 1.6 @@ -25,7 +25,7 @@ /* * Set some basic definitions */ -#define VER "$Id: froggix.c,v 1.4 2009/04/07 04:16:45 nick Exp $" +#define VER "$Id: froggix.c,v 1.6 2009/04/22 03:54:22 nick Exp $" #define TITLE "Froggix" #define SCREEN_WIDTH 640 #define SCREEN_HEIGHT 480 @@ -1063,36 +1063,29 @@ void froggerReset ( void ) { * algorithm for calculating the distance and time */ void moveFrogger( void ) { - int currentFrame = 0; int x = 0; int y = 0; int h = FRAME; int w = FRAME; - int frameLow = HOP_SPEED / 3; - int frameHigh = frameLow * 2; - - /* Determine which frame of frogger to display */ - if ( ( frogger.hopCount >= frameLow ) && ( frogger.hopCount <= frameHigh ) ) - currentFrame = FRAME; frogger.oldPlacement[Y] = frogger.placement[Y]; frogger.oldPlacement[X] = frogger.placement[X]; switch( frogger.direction ) { case UP: - x = currentFrame; + x = FRAME; frogger.placement[Y] -= ( HOP_DISTANCE / HOP_SPEED ); break; case DOWN: - x = currentFrame + ( 4 * FRAME ); + x = ( 5 * FRAME ); frogger.placement[Y] += ( HOP_DISTANCE / HOP_SPEED ); break; case LEFT: - x = currentFrame + ( 6 * FRAME ); + x = ( 7 * FRAME ); frogger.placement[X] -= ( HOP_DISTANCE / HOP_SPEED ); break; case RIGHT: - x = currentFrame + ( 2 * FRAME ); + x = ( 3 * FRAME ); frogger.placement[X] += ( HOP_DISTANCE / HOP_SPEED ); break; } @@ -1122,6 +1115,7 @@ void moveFrogger( void ) { frogger.direction = FALSE; score += SCORE_HOP; lives += freeFrog( score ); + frogger.src.x -= FRAME; } } @@ -1293,16 +1287,17 @@ void drawGoals( void ) { drawImage( gfx, FRAME * 15, 0, FRAME, FRAME, screen, goals[i].x + 13, goals[i].y + 5, 255 ); if( goals[i].fly ) { - drawImage( gfx, FRAME * 16, 0, FRAME, FRAME, + drawImage( gfx, FRAME * 17, 0, FRAME, FRAME, screen, goals[i].x + 13, goals[i].y + 5, 255 ); } if( goals[i].gator ) { - int frame = 17; + int frame = 18; + int diff = 10; if ( goals[i].gator > ( ( int ) GATOR_MAX_TIME / 2 ) ) - frame++; + diff = 0; - drawImage( gfx, FRAME * frame, 0, FRAME, FRAME, + drawImage( gfx, FRAME * frame + diff, 0, FRAME, FRAME, screen, goals[i].x + 13, goals[i].y + 5, 255 ); } }