HeladoDeBrownie / Nexus

creative sandbox game in early development
MIT License
3 stars 1 forks source link

dynamically determine entity overdraw area #82

Open HeladoDeBrownie opened 3 years ago

HeladoDeBrownie commented 3 years ago

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

HeladoDeBrownie commented 3 years ago

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