Skip to content

Commit

Permalink
Merge pull request #38 from jsmolina/feature/vidas
Browse files Browse the repository at this point in the history
WIP add nampac sprite for showing lives
  • Loading branch information
jsmolina authored Jun 18, 2019
2 parents 767d0fc + 900013d commit e0aff83
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 15 deletions.
Binary file removed .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ compile:
png2udg ./build/union_left.png -a > ./build/union_left.asm
png2udg ./build/door.png -a > ./build/door.asm
png2udg ./build/ghostpill.png -a > ./build/ghostpill.asm
png2udg ./build/vidas.png -a > ./build/vidas.asm
png2sp1sprite ./build/prota_sprites.png -b -i sprite_protar -f 16 -s rodata_user > ./build/prota.asm
png2sp1sprite ./build/prota_dead.png -b -i sprite_protar_dead -f 16 -s rodata_user > ./build/prota_dead.asm
png2sp1sprite ./build/red_ghost.png -b -i red_ghost -f 16 -s rodata_user > ./build/red_ghost.asm
Expand Down
Binary file added build/1UP.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/Hiscore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions build/binaries.lst
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ union_left
union_right
door
letterboxes
vidas
4 changes: 4 additions & 0 deletions build/vidas.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SECTION rodata_user
PUBLIC _vidas
._vidas
defb @00011100, @00111110, @01111000, @01110000, @01111000, @00111110, @00011100, @00000000
Binary file added build/vidas.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions game_zx.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ void print_points() {

if(col != 0) {
for(idx = 0; idx != 5; ++idx) {
sp1_PrintAtInv(0, 26 + idx, INK_CYAN | PAPER_BLACK, '0');
sp1_PrintAtInv(0, 25 + idx, INK_CYAN | PAPER_BLACK, '0');
}
}
idx = 0;
while(chars[idx] != '\0') {
sp1_PrintAtInv(0, 26 + idx + col, INK_CYAN | PAPER_BLACK, chars[idx]);
sp1_PrintAtInv(0, 25 + idx + col, INK_CYAN | PAPER_BLACK, chars[idx]);
++idx;
}

Expand Down
2 changes: 2 additions & 0 deletions globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,5 +198,7 @@ extern uint8_t letterboxes7[];
extern uint8_t letterboxes8[];
extern uint8_t letterboxes9[];

extern uint8_t vidas[];

#endif

30 changes: 18 additions & 12 deletions logic.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,14 @@ void reset_map() {

}

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');
sp1_PrintAtInv(0, 22, INK_WHITE | PAPER_BLACK, 'H');
sp1_PrintAtInv(0, 23, INK_WHITE | PAPER_BLACK, 'I');
sp1_PrintAtInv(0, 24, INK_WHITE | PAPER_BLACK, '-');

sp1_PrintAt(0, 2, INK_WHITE | PAPER_BLACK, '1');
sp1_PrintAt(0, 3, INK_WHITE | PAPER_BLACK, 'U');
sp1_PrintAt(0, 4, INK_WHITE | PAPER_BLACK, 'P');
sp1_PrintAt(0, 5, INK_WHITE | PAPER_BLACK, '-');
// as points are restored...
remaining_points = 238;

Expand Down Expand Up @@ -542,3 +538,13 @@ void check_fsm() {
show_cherry();
}
}

void paint_lives() {
for(idx = 0; idx != 6; ++idx) {
if(idx < lives) {
sp1_PrintAtInv(0, 6 + idx, INK_YELLOW | PAPER_BLACK | BRIGHT, 'z');
} else {
sp1_PrintAtInv(0, 6 + idx, INK_BLUE | PAPER_BLACK, 'a');
}
}
}
1 change: 1 addition & 0 deletions logic.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ extern void reset_map();
extern void set_ghosts_offsets();
extern void show_billboard(uint8_t offset);
extern void hide_billboard();
extern void paint_lives() ;
#endif
3 changes: 2 additions & 1 deletion msnampac.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ int main()
sp1_TileEntry('w', union_left);
sp1_TileEntry('x', union_right);
sp1_TileEntry('y', door);
sp1_TileEntry('z', vidas);

pacman.sp = add_sprite();
pacman.alt = add_dead_prota_sprite();
Expand Down Expand Up @@ -144,7 +145,7 @@ int main()
}

if(repaint_lives) {
sp1_PrintAtInv(0, 8, INK_CYAN | PAPER_BLACK, 48 + lives);
paint_lives();
repaint_lives = 0;
}

Expand Down

0 comments on commit e0aff83

Please sign in to comment.