From b36e1e3bafc56a6bb32e25cbf96685780de2b597 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Tue, 27 Aug 2024 19:58:44 +0200 Subject: [PATCH] change sprite.hide() : now disables sprite instead of moving it offscreen. added sprite.show() to re-enable it (with z-order 3, as all sprites have by default in this module) added sprite.zdepth() to set a custom z-depth. --- compiler/res/prog8lib/cx16/sprites.p8 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/compiler/res/prog8lib/cx16/sprites.p8 b/compiler/res/prog8lib/cx16/sprites.p8 index 0723fbdc9..d89f16b20 100644 --- a/compiler/res/prog8lib/cx16/sprites.p8 +++ b/compiler/res/prog8lib/cx16/sprites.p8 @@ -138,7 +138,15 @@ sprites { } sub hide(ubyte spritenum) { - pos(spritenum, -64, -64) + cx16.vpoke_and(1, VERA_SPRITEREGS + 6 + spritenum*$0008, %11110011) + } + + sub show(ubyte spritenum) { + cx16.vpoke_or(1, VERA_SPRITEREGS + 6 + spritenum*$0008, %00001100) + } + + sub zdepth(ubyte spritenum, ubyte depth) { + cx16.vpoke_mask(1, VERA_SPRITEREGS + 6 + spritenum*$0008, %11110011, depth<<2) } sub flipx(ubyte spritenum, bool flipped) {