version 1.4, 2009/04/07 04:16:45
|
version 1.5, 2009/04/11 13:01:54
|
Line 1063 void froggerReset ( void ) {
|
Line 1063 void froggerReset ( void ) {
|
* algorithm for calculating the distance and time |
* algorithm for calculating the distance and time |
*/ |
*/ |
void moveFrogger( void ) { |
void moveFrogger( void ) { |
int currentFrame = 0; |
|
int x = 0; |
int x = 0; |
int y = 0; |
int y = 0; |
int h = FRAME; |
int h = FRAME; |
int w = 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[Y] = frogger.placement[Y]; |
frogger.oldPlacement[X] = frogger.placement[X]; |
frogger.oldPlacement[X] = frogger.placement[X]; |
|
|
switch( frogger.direction ) { |
switch( frogger.direction ) { |
case UP: |
case UP: |
x = currentFrame; |
x = FRAME; |
frogger.placement[Y] -= ( HOP_DISTANCE / HOP_SPEED ); |
frogger.placement[Y] -= ( HOP_DISTANCE / HOP_SPEED ); |
break; |
break; |
case DOWN: |
case DOWN: |
x = currentFrame + ( 4 * FRAME ); |
x = ( 5 * FRAME ); |
frogger.placement[Y] += ( HOP_DISTANCE / HOP_SPEED ); |
frogger.placement[Y] += ( HOP_DISTANCE / HOP_SPEED ); |
break; |
break; |
case LEFT: |
case LEFT: |
x = currentFrame + ( 6 * FRAME ); |
x = ( 7 * FRAME ); |
frogger.placement[X] -= ( HOP_DISTANCE / HOP_SPEED ); |
frogger.placement[X] -= ( HOP_DISTANCE / HOP_SPEED ); |
break; |
break; |
case RIGHT: |
case RIGHT: |
x = currentFrame + ( 2 * FRAME ); |
x = ( 3 * FRAME ); |
frogger.placement[X] += ( HOP_DISTANCE / HOP_SPEED ); |
frogger.placement[X] += ( HOP_DISTANCE / HOP_SPEED ); |
break; |
break; |
} |
} |
Line 1122 void moveFrogger( void ) {
|
Line 1115 void moveFrogger( void ) {
|
frogger.direction = FALSE; |
frogger.direction = FALSE; |
score += SCORE_HOP; |
score += SCORE_HOP; |
lives += freeFrog( score ); |
lives += freeFrog( score ); |
|
frogger.src.x -= FRAME; |
} |
} |
} |
} |
|
|