Destroy and respawn actor

Hello!

I am working on a type of endless runner game, where actors move from the top of the screen to the bottom and then they are destroyed when moving outside of the screen.
All the actors can be destroyed by clicking on them while they move across the screen.
I followed a tutorial for an endless runner to create my level, but in the tutorial the actors were platforms for the player to jump on, and not obstacles to be destroyed.

I have run into a few issues while trying to make this work (pictures of function at the end).

First function: The actor move across the screen, when it reaches the end it is destroyed and a new actor spawns at top (this function loops just perfect)

Second function: I can click on the actor and destroy it. A new actor should at this point spawn so that it would be a loop just like when reaching the end of the screen.
But nothing happens, the actor is destroyed but no new actor spawns.

I also have a few other functions to make the actor move, and spawn at the correct position (Additional function link).

Thanks in advance for any help anyone might provide!


ACTION ONE (Spawn new actor)
https://www.dropbox.com/s/y654qqiejcw0ede/Spawn new Actor.png


ACTION TWO (Click on actor)
https://www.dropbox.com/s/g1mtd8m0vfsdqki/Click Actor.png


Additional function
https://www.dropbox.com/s/9pse4xz5wjv8i7r/Aditional function.png

Comments

  • kasimirkasimir Member Posts: 23

    make a boolean attribute and when the actor is destroyed it turns it true.

    then make another actor that if the attribute is true spawns the actor and turns the attribute to false. put this to the side of the screen.

Sign In or Register to comment.