HeladoDeBrownie / Nexus

creative sandbox game in early development

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dynamically determine entity overdraw area

HeladoDeBrownie opened this issue · comments

currently, when two entities overlap at least partially, transparent pixels from the one drawn on top replace any pixels from the one drawn on bottom. this applies to the whole area of the top sprite (currently 12×12). however, when the sprite doesn't visually occupy the entire area, this can look awkward

this feature involves computing a bounding box for the opaque region of the top sprite (plus one pixel of padding) and ignoring any transparent pixels that lie outside of that for purposes of overdrawing

this might be trickier but instead of a bounding box we could trace an outline. could be a bitmask that's computed dynamically when the sprite changes