Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by John

So I'm making a game for ios, and because of the amount of images in it I'm having a lot of lag. So I need to know how to only load the resources I need for the menus at the start. Then I need to load the resources for a level and the entities when people click to play it, and then unload the previous level's resources and entities.

I kinda know how to unload the level's resources using Dominic's method:


delete backgroundMap.tiles;
delete ig.Image.cache['media/foo.png'];
delete LevelFooResources[0];


But how would I do this for an entity?

1 decade ago by DanielGray

I believe you would use Entity.kill()

I also noticed that if the player dies and you don't have anything specific happen when it is removed/killed, it becomes undefined, so I would think it removes it in the way you want.

1 decade ago by Joncom

I'm not sure I understand the problem. Because if you have too many resources loaded (it sounds like that is what you are saying), this will not cause lag. It is simply using memory space. Only entities you currently have spawned can cause lag. The key is to spawn which entities are necessary, and remove them if you don't need them. For example, there should generally not be a player entity spawned on your title screen.
Page 1 of 1
« first « previous next › last »