• Hey! Guest! The 40th (!!!) GMC Jam will take place between February 25th, 12:00 UTC to March 1st 12:00 UTC. Why not join in this very special anniversary jam! Click here to find out more!

GMS 2 Destroying sprites form layer

Sabnock

Member
instance_destroy(); if it is a sprite in an instance.

if you are using draw_sprite() just stop drawing it

if it is a layer you want to destroy use layer_destroy();

if it is something you have drawn to a surface then that is something different

??
 
Yeah that works, but it destroys them one at a time. I would have to repeat the function too many times to be effective. (There might be more than just 10 of them. It's a survival game. )
 

Sabnock

Member
Yeah that works, but it destroys them one at a time. I would have to repeat the function too many times to be effective. (There might be more than just 10 of them. It's a survival game. )
if you destroy the layer and recreate it does it affect anything else?
 
I "solved" the problem by abandoning the layer_sprite_create() and using draw event. The performance takes a huge hit but at least it works. If anyone still has a solution on how to get rid of the sprites created with layer_sprite_create(), I'm all ears here. Thanks all, for the help so far.
 
Top