Question to organize an array of sprites

Général

jicehel

il y a 6 ans

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 il y a 6 ans

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 il y a 6 ans

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 il y a 6 ans

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

jicehel

NEW il y a 6 ans

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