I have an object (enemy) that gets destroyed when a tween finishes.
Next, I want to know if it’s possible to respawn the object after it has been destroyed.
For example: Start a timer > when timer gets to 20 seconds > respawn the object that’s been destroyed.
Here is how I’m going to try to make it work:
When an object receives the tween that destroys it, I will save the current position of that object in a variable. Then I’ll set a timer and when the timer is done, it will create a new object positioned at the spot the variable defined.
Maybe you can create an invisible object in the position of the enemy (make sure to put the create object action before of the destruction of the enemy in the order of event actions), and when the timer is X seconds, create your enemy over the invisible object.
Here is what I tried. It failed create a new object though. Any idea why?
Update: this seemingly creates a zero opacity object in the correct location. Trying to figure out how to make the respawned object have 100% opacity.
Even with tweening the opacity back to 100 doesn’t make the respawned object opaque. It does create a totally invisible object though which is weird.
I got it to work by changing the z-order of the respawned object.
I tried this and it works. You have to upgrade it to your needs (like changing the opacity of invisible object following it creation).
The WalkingEnemy movement with A key is only to probe that the new apparition depends of the last position before its destruction.
Thanks, I got it to work as well with a slightly different method. Now I just have to figure out how stack multiple timers for killing multiple enemies which all need to respawn.
You could try the “for every object…” event.