From 2baf1e4c578e99db0a3617912b3b209a9ab4b4f1 Mon Sep 17 00:00:00 2001 From: iggy Date: Tue, 2 Aug 2011 18:20:16 +0200 Subject: [PATCH] invaders, mostly finished now --- firmware/loadable/spaceinvaders.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/firmware/loadable/spaceinvaders.c b/firmware/loadable/spaceinvaders.c index 7e482f6..c531eca 100644 --- a/firmware/loadable/spaceinvaders.c +++ b/firmware/loadable/spaceinvaders.c @@ -37,11 +37,12 @@ struct gamestate { char shots_x[ENEMY_COLUMNS]; char shots_y[ENEMY_COLUMNS]; char alive; - char move, direction, lastcol; + int16_t move; + char direction, lastcol; bool killed; bool step; uint32_t score; - char level; + uint16_t level; int8_t rokets; char enemy_x[ENEMY_ROWS][ENEMY_COLUMNS]; char enemy_row_y[ENEMY_ROWS]; @@ -268,7 +269,7 @@ void move_shots() { if (game.shots_x[col] == DISABLED) { for (char row = 0; row 0){ - game.move--; + game.move-=game.level/5+1; return; } @@ -380,7 +381,7 @@ void move_enemy() { (pos >=RESX-11-1 && game.direction == 1)){ game.direction = (game.direction==1)?-1:1; for (char r = 0; r=23?4:2; } return; } @@ -389,7 +390,7 @@ void move_enemy() { } } - game.move = game.alive-1; + game.move = game.alive*2-1; } void draw_player() { @@ -476,7 +477,7 @@ void check_end() { if (game.killed) { game.rokets--; delayms(500); - game.player = RESX/2+4; + game.player = RESX/2-4; for(int col=0; col