Good morning, everyone,
for my game I have coded a basic life system and once the collision with the sprite is done I destroy it but it continues to work even after being destroyed how to fix it?
My code :
//condition for wins the health points
if (character.x < life.x + life.width + 33 && character.x + character.width - 33
> life.x && healthPoints !==3 )
{
healthPoints++;
//Once time the sprite enter in collision this one is deleted of the memory
life.destroy();
}