Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

TIC-80

Fantasy computer for making, playing and sharing tiny games. · By Nesbox

tic-80 0.8 sprite flags?

A topic by CalebQ created Oct 05, 2019 Views: 1,064 Replies: 1
Viewing posts 1 to 2

Just how do these work?

(2 edits)

They are eight general-purpose flags assigned to each sprite individually, used for whatever purpose by your game. PICO-8 already has something similar, but there isn't any part of the TIC-80 API that has yet to do anything with these sprite flags (other than peek/poke).

Here's some sample code for you:

function fget(sprID,bit)
 return peek(0x14400+sprID)>>bit&1==1
end
function fset(sprID,bit,flag)
 local old=peek(0x14400+sprID)
 poke(0x14400+sprID,flag and old|(1<<bit) or old&~(1<<bit))
end

EDIT: Changed base address for sprite flags, after a certain commit on GitHub added the persistent storage memory to where they were previously.