Skip to content

Commit

Permalink
next level pass
Browse files Browse the repository at this point in the history
  • Loading branch information
jsmolina committed May 24, 2019
1 parent 884996b commit e005623
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 26 deletions.
2 changes: 1 addition & 1 deletion globals.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ uint8_t frame = 0;

uint8_t lives = 0;
uint8_t repaint_lives = 1;
uint8_t speed = 5;
uint8_t speed;
uint8_t idx;
struct sprite * collided_sprite;
31 changes: 31 additions & 0 deletions logic.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,33 @@
#include "int.h"
#include <sound.h>

void reset_map() {
for(row = 0; row != 24; ++row) {
for(col = 0; col != 32; ++col) {
if(map[row][col] == 18) {
map[row][col] = 11;
} else if(map[row][col] == 16) {
map[row][col] = 9;
}
current = map[row][col];
sp1_PrintAtInv(row, col, colors[current] | INK_BLACK, correspondence[current]);
}

}

sp1_PrintAtInv(0, 19, INK_RED | PAPER_BLACK, 'P');
sp1_PrintAtInv(0, 20, INK_RED | PAPER_BLACK, 'O');
sp1_PrintAtInv(0, 21, INK_RED | PAPER_BLACK, 'I');
sp1_PrintAtInv(0, 22, INK_RED | PAPER_BLACK, 'N');
sp1_PrintAtInv(0, 23, INK_RED | PAPER_BLACK, 'T');
sp1_PrintAtInv(0, 24, INK_RED | PAPER_BLACK, 'S');

sp1_PrintAt(0, 2, INK_RED | PAPER_BLACK, 'L');
sp1_PrintAt(0, 3, INK_RED | PAPER_BLACK, 'I');
sp1_PrintAt(0, 4, INK_RED | PAPER_BLACK, 'V');
sp1_PrintAt(0, 5, INK_RED | PAPER_BLACK, 'E');
sp1_PrintAt(0, 6, INK_RED | PAPER_BLACK, 'S');
}

void show_cherry() {
cherry.y = 21;
Expand Down Expand Up @@ -271,8 +298,12 @@ void next_level() {
bit_beepfx_di_fastcall(BEEPFX_SCORE);
zx_border(INK_BLACK);
remaining_points = 238;
reset_map();
nampac_go_home();
all_ghosts_go_home();
if (speed > 1) {
--speed;
}
}


Expand Down
1 change: 1 addition & 0 deletions logic.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ extern void hide_cherry();
extern void show_cherry();
extern void nampac_go_home();
extern void all_ghosts_go_home();
extern void reset_map();
#endif
27 changes: 2 additions & 25 deletions msnampac.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ void all_lives_lost() {
sp1_Invalidate(&full_screen);
lives = 5;
points = 0;
speed = 5;
nampac_go_home();
repaint_lives = 1;
remaining_points = 238;
Expand Down Expand Up @@ -48,31 +49,7 @@ void all_lives_lost() {
ghost_yellow.default_y = 15;
ghost_yellow.default_x = 18;

for(row = 0; row != 24; ++row) {
for(col = 0; col != 32; ++col) {
if(map[row][col] == 18) {
map[row][col] = 11;
} else if(map[row][col] == 16) {
map[row][col] = 9;
}
current = map[row][col];
sp1_PrintAtInv(row, col, colors[current] | INK_BLACK, correspondence[current]);
}

}

sp1_PrintAtInv(0, 19, INK_RED | PAPER_BLACK, 'P');
sp1_PrintAtInv(0, 20, INK_RED | PAPER_BLACK, 'O');
sp1_PrintAtInv(0, 21, INK_RED | PAPER_BLACK, 'I');
sp1_PrintAtInv(0, 22, INK_RED | PAPER_BLACK, 'N');
sp1_PrintAtInv(0, 23, INK_RED | PAPER_BLACK, 'T');
sp1_PrintAtInv(0, 24, INK_RED | PAPER_BLACK, 'S');

sp1_PrintAt(0, 2, INK_RED | PAPER_BLACK, 'L');
sp1_PrintAt(0, 3, INK_RED | PAPER_BLACK, 'I');
sp1_PrintAt(0, 4, INK_RED | PAPER_BLACK, 'V');
sp1_PrintAt(0, 5, INK_RED | PAPER_BLACK, 'E');
sp1_PrintAt(0, 6, INK_RED | PAPER_BLACK, 'S');
reset_map();

all_ghosts_go_home();

Expand Down

0 comments on commit e005623

Please sign in to comment.