Question to organize an array of sprites

General

jicehel

6 years ago

Hello. I would rewrite my Parachute for META but i would write it better and i would know how to do it as best as possible.

One of the thing i would do better is the managment of the sprites positions and data.

I have 3 "colons" of 7 or less possible sprites. For each i have a structure like x,y and data of the sprite.

So i ask your opinion of what solution will be the best: one array for positions and another for data ?

One array of one structure. A two dimensions array ? An array of 21 posibilities ?

Please give me some code examples with your advises.


Else to be transparent have i to do something on my picture before convert them ? (How can i manage transparency in my sprites data ?)


Aurélien Rodot

NEW 6 years ago

Not sure if that's what you're asking for but you can have an Image with several frames, and you choose which frame to draw with setFrame. This way you can switch between different sprites.

jicehel

NEW 6 years ago

Could someone (maybe not you Rodot as i know you're very busy (and i don't say that other are not but i hope just they are less busy  ;) ) put an code example to do it (with an Image) but with an easy way to manage this array of sprites (i can organize my image to let the managment be easy)

Aurélien Rodot

NEW 6 years ago

Actually, there is one in the link I provided, under the title "SPRITESHEET & TILEMAPPER" :)

jicehel

NEW 6 years ago

Thanks Rodot, you're right. I will try this.