Log In  


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



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


Thank


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


[Please log in to post a comment]