Game Lab: Destroy and Recreate same player sprite


Working on game where the player sprite is destroyed when it touches an enemy sprite, and the player sprite is recreated after 2 seconds. Is it possible to recreate that same player sprite?

I could move the player sprite off the screen instead of destroying it but wanted to see if its possible to destroy and then recreate it.

Hi @michael.coyner,

You sure can reuse a sprite after it is destroyed! You just need to use the createSprite again. There is a good example on the documentation for destroy() in the Rain Rain Go Away example.

Hope that helps!

I saw that but there is no toolbox option to create a sprite w/o the var. You have to remove the var in the show text. Am I not seeing that toolbox option??

Correct - there is not a create a sprite w/o the var. You wouldn’t need the var block again since the variable has been declared already as a global variable. You’ve probably figured out you can make it work with the x=___ block from variables and then move the createSprite from the var sprite block.

Personally, I would quickly switch to text and remove the var and then switch back to blocks. You can make a suggestion to support for the addition of the block. I’m not sure it is used enough to make a block and may confuse kids. My thinking is if a student is savvy enough to destroy a sprite and then want to put it back, they can easily go to text and remove the var:)

that’s what I did…thx for the info:)