kitao / pyxel

A retro game engine for Python
MIT License
15.35k stars 847 forks source link

Feature Request: Sprite Flag(s) #576

Open paul59 opened 1 month ago

paul59 commented 1 month ago

TIC-80 has a set of eight boolean flags per sprite which are incredibly useful, for example for denoting 'walkable' tiles, special objects etc. It would be great if Pyxel had a similar feature (or maybe there's some simple alternative already in place that I'm missing?).

merwok commented 1 month ago

This comes from PICO-8, and it is indeed a great way to encode information into sprites, so that you can change a level in the map editor and get correct behaviour (solid wall, liquid, teleport, monster spawn point…)

Current alternative: maintain a list of sprite identifiers in your code to know which behaviour is needed. Or create your convention like «sprites in bank 1 are all solid».

Additional: sprite are great when all uses of that sprite need the same handling, but for other needs it’s good to have map flags, for example set a bit on a tile in the map to mark it rotated or special in other ways (picotron has these for example – «flip bits»; see also https://www.youtube.com/watch?v=ZWQ0591PAxM for other cool ideas that can be done with extra bits)