How To

How to get sprite palette number ?


G-9 2021-04-15 10:13

I need it for checks for another game :3
Amount of game wip : 14 !

CubicleHead 2021-04-15 11:27 (Edited)

I think you can use Sprite.a
Idk much about this...

Edit: I just realized that the program wouldn't run because I forgot to add REM before a comment >U< sry I have a fixed version now

qwaffe 2021-04-15 11:30 (Edited)

kinda forgot how the bits work but:

it says that the palette is bits 0-2 of SPRITE.A. if this does mean the three biggest bits then you probably only need to do
(n is the sprite number)

if the bits 0-2 are actually the lowest bits (the correct one) then its just

(Edit: bits 0-2 are the three lowest bits)

nathanielbabiak 2021-04-15 12:39

Bit 0 is the low bit of a byte, bit 7 is the high bit of a byte, so MOD 8 or AND 7 is correct.

G-9 2021-04-15 13:29 (Edited)

Thank you all ๐Ÿ™ !

qwaffe 2021-04-15 23:28

@nathanielbabiak i didnt know that, thanks

nathanielbabiak 2021-04-16 02:36 (Edited)

I actually had a bit of trouble finding a good source for bitwise annotations. Check this out - middle of page 4 - unfortunately it's a PDF not a website:

G-9 2021-04-17 08:05

@cubiclehead Donโ€™t worry I saw the error :3

Benimo12 2021-04-30 20:51

If I understand you correctly, you want to be able to print the palette number in use and in that case, you can make the palette the number a variable e.g

LET P = 2

In that case, โ€œPโ€ is the palette number.

Log in to reply.