How to switch scene when all of one actor dies in scene

Holypeanut187

  • Posts: 12

Im making a game sort of like missle command and i was wondering how to make it to when all of my cities die in a scene to go to a different scene (main menu)
If you can please post screenshot

Bombini

  • *
  • Posts: 1392
Hi,
You can get the amount of one actor type with something like “for each actortype add 1 to a number attribute(which you have to create)”.
Go to next scene if number is 0.
Cheers!


Holypeanut187

  • Posts: 12
im in the scene behavior menu and i made it and im editing it i have the code up until you add 1, how do i do that?

NerdinaNutshell

  • *
  • Posts: 251
Your going to want to show a picture it’s hard to understand the problem if we can’t see it.
*Puff*


Holypeanut187

  • Posts: 12
my game is about shooting missles and AA guns at meteors that fall from sky and i want it to go back to main menu when all of your cities are destroyed

JeffreyDriver

  • Posts: 2262
For each actor of type
Increment (your number attribute) by 1

When actor of type is killed
Decrement (your number attribute) by 1

If (your number attribute) equals 0 or less
Switch to (your scene)

JeffreyDriver

  • Posts: 2262
You need to create a number attribute to record the number of cities remaining.

ATTRIBUTES > GETTERS > CREATE ATTRIBUTE

Holypeanut187

  • Posts: 12
the if block dosent accept number attributes just boolean

JeffreyDriver

  • Posts: 2262
You need the blocks under CONDITIONS > COMPARISONS

Stick the <= block in the if statement first

Can I ask if you've done teh crash course yet? If not, you will find it helpful.

Holypeanut187

  • Posts: 12
i started using stencyl a long time ago on my old pc and got it on my new one, signed into my account and when i looked for crash course i couldnt find it and i dont know how to get it

Holypeanut187

  • Posts: 12
i stopped using it for a while