- Home /
Freezing on destruction of terrain.
Hi, I've been working on a worms clone. I have a script which uses a binary image for the terrain, and I edit it to show explosions, etc. Here is the code: http://pastebin.com/RKCgPikJ
I've tried adding co routines and the such, but everytime the damage function is called, I get a momentary freeze.
Given that worms had this functionality on far more primitive machines, I know there must be a way to get rid of the freeze.
Is there a better way to handle this, or perhaps something I should add to my code to improve it? Thanks.
Answer by cjdev · Jun 10, 2016 at 02:23 PM
I'm not sure I got all that but you're making way too many binary images and Sprites. Those are fairly costly operations and you're going to notice a performance hit if you do it that many times in Update. Try cutting it down to a single one after you've processed an image that you re-use throughout.