The math actually isn't too complex to make essentially a flag system for entities, I'm using one of those in my WIP Pico-8 port of Super Mario Bros. I just use the actual power-of-2 values to turn behaviors on or off. For example: 128: map collision 064: interact w/ other entities 032: hurt player 016: can be stomped Then I just made a little function called flag() that you input values into, and it tests if that number (or collection of numbers) are present or not using the '&' operator. Since it only requires one number input, you can put it inside quotes, so each function call only takes 2 tokens. Of course, this is just for on/off type features, other properties are separate values, but each entity's data is stored as a string that's turned into a table via split().
@molochz8 ай бұрын
Noice! I want to put loads of ground enemies in my game.
@WardenAzdron5 ай бұрын
Once more, unto the breach brothers! also dont copy more than like 5 ground enemies or the placement starts to wander.
@llpBR6 ай бұрын
At 34:48 there is an character that looks like a comma but is inverted. What??? That actually caught my attention 😅
@terry-7 ай бұрын
Great!
@maxine_red8 ай бұрын
To be honest? Doing it the way you do (not doing it bitwise) is smarter, because it is a lot more readable and will save you a lot of time later. Often it is smarter to optimize for readability, than to squeeze out 4 bytes of memory or a couple microseconds over the entire game.
@JadeLombax8 ай бұрын
Packing data in tighter can be useful when you're making something ambitious that's running up against storage limits. If you have plenty of headroom, yeah, simpler is better.