c) Store sprites with self method : self.mySprite = Sprite.new() and add and remove them. 500 sprites (visible or invisible) in stage means low fps in low end devices.
(a) everytime. But depending on what you are doing it might be best to have two lists, one 'available' and one 'used'. Update the positions of the used ones, if a sprite goes from used to available then take it from the used list and put it in the available list, at the same time make it invisible. Just take a sprite from the available list as you need it.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
@SinisterSoft - True. I have been thinking and rethinking my own requirements and I will need 2 lists of actors anyway, those that collide and those that don't.
Comments
500 sprites (visible or invisible) in stage means low fps in low end devices.
@amin13a, thanks also but now I'm quite confused. I thought creating and destroying sprites rapidly would be really slow?
Hiding and Showing probably should be the fastest, as far as I remember Sprite is removed from rendering then.
https://deluxepixel.com
I will keep the multiple list idea in mind but can't see how much faster that would make anything.
Likes: antix
https://deluxepixel.com
if (adding and removing sprites == create and destroy them) then
use a) approach
else
my approach
end
I have tested it guys!