How do I remove sprites?

Hi all. New to Thunkable X, and loving it. I’m playing around with canvas and sprites, mostly for the learning experience. I created a simple game called Blasteroids (not very original, but as I said, designed for learning value. You can find it here:

I’m running into trouble with what I think may be memory issues. After playing two rounds, the third round bogs down significantly. I’m not sure why. I “remove” the sprites once they are destroyed by the missiles. Any help would be appreciated. I’m open to any and all suggestions. I’m a novice programmer and welcome any technique suggestions.



By the way, I’m testing it in iOS.

Quickly checking, I see that when a missile hits a target, you are hiding both the missile and target sprites, but I do not see you really removing them. The only ‘remove’ I see is the one that takes care of missiles reaching the edge of the canvas.

Accordingly, each stage adds more and more targets, which the system keeps moving around even if the are not seen, and all these extra computations eventually bog down the system.

How to write @CBVG if you pour water into the bath, but do not pour the water from the bath, the bath will soon be filled with water from it will pour out and flood the apartment, and in your case, the application freezes or crashes.

But I want to draw your attention to something else. You have on the screen are repeating units, and is a good source of error. Imagine that you need on the screen to create 100 targets. Thank you for that will create 100 units? No, it needs to use a single unit, which will create 100 targets. Do you understand what I want to say what?

Now on your screen just a few objects, but to work with them you use as many blocks as if creating a strategy. The more blocks on the screen - the more difficult to understand them and find errors.

@CBVG thanks for your reply. Yes, I tried to use “hide” instead of “remove”, but same results. I went back to “remove” but the app still slows down significantly. I’m wondering if the remove function actually works…

Based on what @actech said, I’ve reduced significantly the number of sprites being generated, and only using one sprite type for the targets. Still getting slow downs. Now, however, I’m also getting some invisible sprites that were previously removed triggering collisions.

Here’s an updated version:

Thanks again for any and all assistance.


I believe I’ve solved the problem. I was spawning sprites outside of the canvas coordinates. Apparently this was causing the problem.

THanks for the help.