A question about performance and memory
I am trying to optimize my games as best as I can, especially when trying to target html5 mobile. There are many areas I don't really know how though and what is happening behind the scenes. I remember reading somewhere that if you have an active with a lot of animation frames in it it takes up a lot of memory and performance and that you could be better off to only have that object in the frame when really needed. This has me thinking of a situation I am in now:
I am doing a game where there will always be one hero and one enemy on the screen at all time, I am thinking about if I should do 20 different objects for every type of enemy and just have one of them created at one time. Or if I should just store all the different enemies in one single object and just play the appropriate animation one at a time. The last option would be more easy when it comes to the actual code since I only need to keep track of one object instead of 20, but I am thinking maybe it needs to load in all the 20 character animations at the same time though instead of just having 1 loaded at a time?
I hope i made myself clear what I am trying to explain..