From 10f089c5893aaf17f690f0b6c96a086568fd9fa5 Mon Sep 17 00:00:00 2001 From: Kistaro Windrider Date: Sun, 1 Oct 2023 13:54:11 -0700 Subject: [PATCH] fix names and labels these aren't "sprite" and "draw" palettes, they're "draw" and "screen" palettes. Fix variable names and labels. --- pal_from_spr.p8 | 54 ++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/pal_from_spr.p8 b/pal_from_spr.p8 index eade345..ceecd3a 100644 --- a/pal_from_spr.p8 +++ b/pal_from_spr.p8 @@ -11,7 +11,7 @@ function _init() poke2(0x5f70, 0xffff) mode = "boxes" - active = "sprite" + active = "draw" scx = 0 scy = 0 dcx = 0 @@ -52,30 +52,30 @@ end function _update() if (btnp(🅾️)) mode = (mode == "boxes") and "rows" or "boxes" - if (btnp(❎)) active = (active == "sprite") and "draw" or "sprite" - if active == "sprite" then - if (btnp(⬆️)) scy -= 1 - if (btnp(⬇️)) scy += 1 - if (btnp(⬅️)) scx -= 1 - if (btnp(➡️)) scx += 1 - else + if (btnp(❎)) active = (active == "draw") and "screen" or "draw" + if active == "draw" then if (btnp(⬆️)) dcy -= 1 if (btnp(⬇️)) dcy += 1 if (btnp(⬅️)) dcx -= 1 if (btnp(➡️)) dcx += 1 + else + if (btnp(⬆️)) scy -= 1 + if (btnp(⬇️)) scy += 1 + if (btnp(⬅️)) scx -= 1 + if (btnp(➡️)) scx += 1 end - scx %= (mode == "boxes") and box_cols or rows_cols dcx %= (mode == "boxes") and box_cols or rows_cols - scy %= (mode == "boxes") and box_rows or rows_rows + scx %= (mode == "boxes") and box_cols or rows_cols dcy %= (mode == "boxes") and box_rows or rows_rows + scy %= (mode == "boxes") and box_rows or rows_rows end function _draw() cls() draw_hud() local pals = (mode == "boxes") and box_pals or rows_pals - pals[scx][scy]:do_both(0) - pals[dcx][dcy]:do_both(1) + pals[dcx][dcy]:do_both(0) + pals[scx][scy]:do_both(1) draw_bars() end @@ -103,18 +103,18 @@ box_cols = 4 function draw_box_hud() spr(1,3,0,4,2) local toff = time() * 4 \ 1 % 2 - spr(107 + (active == "sprite" and toff or 0), - 3+8*scx,4*scy,1,0.5) - spr(109 + (active == "draw" and toff or 0), + spr(107 + (active == "draw" and toff or 0), 3+8*dcx,4*dcy,1,0.5) + spr(109 + (active == "screen" and toff or 0), + 3+8*scx,4*scy,1,0.5) - print_shadow("spr",42,1,12) - print_shadow(lpad(boxspr(scx,scy),3),42,9,6) - sspr(8+8*scx,4*scy,8,4,55,4,16,8) + print_shadow("draw",42,1,12) + print_shadow(lpad(boxspr(scx,scy),3),46,9,6) + sspr(8+8*dcx,4*dcy,8,4,59,4,16,8) - print_shadow("draw",73,1,14) + print_shadow("scr",77,1,14) print_shadow(lpad(boxspr(dcx,dcy),3),77,9,6) - sspr(8+8*dcx,4*dcy,8,4,91,4,16,8) + sspr(8+8*scx,4*scy,8,4,91,4,16,8) end rows_rows = 8 @@ -124,16 +124,16 @@ function draw_rows_hud() spr(33,0,0,2,2) spr(35,22,0,2,2) local toff = time() * 4 \ 1 % 2 - spr(103 + (active == "sprite" and toff or 0), - 17 + 22*scx, 2*scy, 0.25, 0.25) - spr(105 + (active == "draw" and toff or 0), + spr(103 + (active == "draw" and toff or 0), 17 + 22*dcx, 2*dcy, 0.25, 0.25) + spr(105 + (active == "screen" and toff or 0), + 17 + 22*scx, 2*scy, 0.25, 0.25) - print_shadow("spr",48,0,12) - sspr(8+16*scx,16+2*scy,16,2,61,2,32,4) + print_shadow("draw",44,0,12) + sspr(8+16*dcx,16+2*dcy,16,2,61,1,32,4) - print_shadow("draw",44,8,14) - sspr(8+16*dcx,16+2*dcy,16,2,61,10,32,4) + print_shadow("scr",48,8,14) + sspr(8+16*scx,16+2*scy,16,2,61,9,32,4) end function draw_bars()