Tilengine - The 2D retro graphics engine forum
Objects list : How to use it? - Printable Version

+- Tilengine - The 2D retro graphics engine forum (http://tilengine.org/forum)
+-- Forum: English forums (http://tilengine.org/forum/forumdisplay.php?fid=3)
+--- Forum: Support (http://tilengine.org/forum/forumdisplay.php?fid=7)
+--- Thread: Objects list : How to use it? (/showthread.php?tid=982)

Pages: 1 2 3 4


RE: Objects list : How to use it? - System64 - 12-28-2020

ah yeah that's useful!

I may also have an idea to store more data than expected

I can for exemple use a 10-digits numbers
I can split this number to obtain each digit and store them in an array
And now I can use the first cell to define the speed, the second to define the loot, the third to define how much damage it does, ...


RE: Objects list : How to use it? - megamarc - 12-28-2020

Yes, that's a way to do it. Integers are 32-bit long, so you have up to 32 bits to encode pieces of separate info.

However I think it may be more manageable if you use type in a simplistic way, and have additional info on game data, not on map data. I mean, that the enemy health and dropped lot depend on enemy type. If you later decide that some kind of enemy needs to have different health or loot type, you just change once in your game data structures. If you've encoded this data in the map, you must change each and every instance of it by hand. That may become tedious and error-prone.


RE: Objects list : How to use it? - System64 - 12-29-2020

(12-28-2020, 10:42 PM)megamarc Wrote: Yes, that's a way to do it. Integers are 32-bit long, so you have up to 32 bits to encode pieces of separate info.

However I think it may be more manageable if you use type in a simplistic way, and have additional info on game data, not on map data. I mean, that the enemy health and dropped lot depend on enemy type. If you later decide that some kind of enemy needs to have different health or loot type, you just change once in your game data structures. If you've encoded this data in the map, you must change each and every instance of it by hand. That may become tedious and error-prone.

Yeah that works too, it depends if each instance has to have the same attributes or if you want each instance can have differents attributes


RE: Objects list : How to use it? - megamarc - 12-31-2020

You'll usually configure those properties at the class/type level, not at each unique instance