move to next level when all enimies die

zayed

  • Posts: 14
hi , how to move to next level only if all enimies are die because i try it and if the first enemy die it will accept it and will move to next level , i need when all enemies  die to go to next level otherwise can not  , i need a help

NexusxAlpha

  • Posts: 157
could make a global attribute for "amount of enemies to kill" and for everyone of the enemies you kill you increment another global attribute (maybe called "enemies killed in level") by 1

then do

if enemies killed in level >= amount of enemies to kill
go to next scene

don't forget that global attributes dont reset themselves so at the end of the level it would be wise to do

enemies to kill = 0
enemies killed = 0

but only do that after the scene as transitioned. Maybe you could do it in the when created of each level? ;)

Nexus

wohoo

  • Posts: 128
There's a "Enemies Killed Switch to next Scene" behavior on the Forge. I'd recommend checking that out.

newton1212

  • Posts: 44
make an attribute on all enemy actors that hinders the stage from moving on so that when all enemies are
destroyed so there is nothing hindering the scene from moving on.

zayed

  • Posts: 14
wohoo , i search it in stency but i did not find it

NexusxAlpha

  • Posts: 157
could use an actor value

when its created set "can be killed?" to "true"

when its killed set to "false"

and make an if statement like

if <actor value <can be killed?> = "false"
do something

oh and wrap in a for each actor of type block

you can then check

for each actor of type enemies
if actor value for enemy = "false"
do switch scene

Xietao

  • Posts: 725
You need to create a number attribute and make as hidden.
set attribute to 0
for each member of [enemies]
increase [attribute] by 1
if <[attribute]=0>
switch scene

(all the blocks in "always" event)
Free Time:
Monday, Wednesday, Friday: 13h
Tuesday, Thursday, Saturday, Sunday: 7h
Loving Linux...

Xietao

  • Posts: 725
Free Time:
Monday, Wednesday, Friday: 13h
Tuesday, Thursday, Saturday, Sunday: 7h
Loving Linux...

takeshigondo

  • Posts: 2
Hi!

I have a similar problem here.
I have a group (enemies) with two different characters that appear in scene at same time.
What I want is that after kill the two enemies, the scene changes to another scene...
I tried the tips you gave here, but what happens is that, after setting the group enemies as the main target, when I run the game, it jumps to the other scene automatically, don't give time even to touch any key.
I can't figure how to give a simple (or any) solution to this situation...

Tuo

  • *
  • Posts: 2469
Hello there,
In the StencylForge, in the games section, search for "Demo-". Then, you can find my "Demo- Explosions". It's a simple game, and one of the features is that the game reloads after every box has been destroyed. Perhaps seeing it in action (and being able to see all of the coding directly) will help you tweak things for your own game.
Don't look to me but rather to the One who is the reason for what I do. :)

If you need help, send me a PM. Even if I haven't been on in the forums in ages, I still receive those messages via email notifications. You can also reply to any of my forum posts, regardless of the age (especially if I created it), and I will likely reply.

If you want to see the programming behind certain types of games, feel free to check out my "Demo-" games on StencylForge (http://community.stencyl.com/index.php/topic,16160.0.html)

takeshigondo

  • Posts: 2
Thanks!

But I got another way to change the scene.
I put a region that change scenes... not the best solution, but, I had to keep the deadline (it's a college's project).
But thanks anyway.  ;)