Destroying and respawning actors without using reset scene

revoltandreverbrevoltandreverb Member Posts: 159
edited July 2014 in Working with GS (Mac)

I have a simple alphabet game.

  • On the top of my screen I have an actor called "letter spawner" that spawns a random single letter from the alphabet.

  • My background actor on the other hand spawns 26 different letters, one for each of the alphabet

  • Currently, when a correct letter is chosen, the chosen letter spawns a "well done" actor and I reset the entire scene so that the "letter spawner" can spawn a new letter and that my background can spawn 26 new letters in new positions.

So everything is working just fine. My problem is, everytime I reset the scene there's a bit of a pause and I have background animation that I don't really want to stop. I basically don't want to reset the scene I just want the "letter spawner" to spawn a new letter and the background to spawn 26 new letters.

What I've tried so far.

  • I've created a boolean called "may_letters_spawn" and set it to true. In my background actor I say that only if "may_letters_spawn" is true, are you allowed to spawn the 26 letters of the alphabet. After the last letter's spawn behaviour I change "may_letters_spawn" back to false. I do this so that I can spawn the letters when may_letters_spawn is set to true.

  • I've created a boolean called "may_letters_live" and set it to true. On each letter actor I say if "may_letters_live" is false, then destroy actor.

  • On the "well done" actor that is spawned, when a correct letter is guessed, I change the "may_letters_live" to false so that the letters can be destroyed. I then change "may_letters_spawn" to true so that the background can generate new letters. On the background I have a change attribute to change "may_letters_live" to true otherwise the letters will get destroyed as soon as they are created.

So current what happens, is that the 26 letters spawn just fine, but when I select a correct one, everything disappears.

Above was for the 26 letters that are spawning. I haven't even thought how the single letter spawner will work. Currently it's already on the scene, but I suppose I should make it so that the background actor spawns it along with the other letters, so that it can be generated and destroyed the same way the 26 letters will be.

Thanks!

Sign In or Register to comment.