Log In  

idk how to get fget to check for a specific flag in picotron

P#144681 2024-03-27 13:04

I imagine it's a bug, but the fget(sprite,flag) syntax doesn't work. However, fget( sprite ) does return the entire bitfield, so to get a specific flag, you can do:

fget( sprite ) & 2^flag > 0

P#144714 2024-03-27 15:52

Thank

P#144715 2024-03-27 15:59
1

This function acts the same as PICO-8's ver, though fget() itself returns a bitfield in Picotron.

This only works on sprites in gfx files labelled with a number (0.gfx,1.gfx...)

function flagget(gfxfile,spriteid,flag)
--gfxfile = 0, 1, 2 etc.
--spriteid = id of selected sprite in that gfxfile
--flag = flag you are checking for

   local checkedsprite= gfxfile*255+spriteid
   return (fget(checkedsprite) & 0b1<<flag)!=0

end
P#144747 2024-03-27 21:41 ( Edited 2024-03-27 21:41)

[Please log in to post a comment]