Kill all actors on the screen at once..

ggiersdorf

  • Posts: 52
Anyone know a quick way to kill all moving actors on the screen at once? I can create individual Kill commands but when there are 4-5 on the screen and once and you die a few seem to continue to stay on the screen..

Thanks!

 

Tuo

  • *
  • Posts: 2469
In the scene palette, there are 'get actor' loops that you can use. For example, "every actor on screen". Just put the 'kill actor' block inside of that loop and drag the pink block from the loop into the kill code to kill everything.
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)

ggiersdorf

  • Posts: 52
Mind showing me I dont see that option on my screen. Went into Scene tab where is shows the layout and noithing there checked under events as well and only found get commands for height width and fonts or frame count from actor..

Thanks sorry

dripple

  • Posts: 748
Tuo refers to the behavior editor, there you find in the palette under "Scene" in the Actors-Tab:
Sure, my games won't get better with all the new features of Stencyl.
But I do have more fun creating bad ones.


MayazCastle Keeper

ggiersdorf

  • Posts: 52
Dripple I found it thanks, however I cant get it to kill all actors. I can specify one actor as they are generated via code no placed on the scene.  I can however go into each actor and do an always IF Game over = True Kill Self...

Kill Self or all actors isnt avialalbe under the Scene events...

Tuo

  • *
  • Posts: 2469
Are you dragging the pink block inside the actor loop into the actor part for the "kill" code?

for example:

for each [actor on screen]
  kill [actor on screen]
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)

ggiersdorf

  • Posts: 52
No I wasnt doing that but figured it out now I didnt know you could drag those out from pre-designed statements! Thanks but sadly I cant get it to work right still.  Should this be in an Always event or where should this be started? It gives me errors when used in always. Unknow Identifier even though I set the actor type.. I cant use ALL because my background is an actor so I can control the speed..


Tuo

  • *
  • Posts: 2469
When do you want it to happen? It should happen within the trigger for it.
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)

Innes

  • *
  • Posts: 1961
I have attached an example of killing all actors on the screen when a control (key) is pressed. You will need to place the [for each actor on screen] block (together with the [kill actor on screen] block) into an appropriate trigger as required in your game.

Note that the red [actor on screen] block that is shown in the blue [kill] block was dragged from the the orange [for each ...] block.
Visit www.TheStencylBook.com - the only published book for learning Stencyl.

ggiersdorf

  • Posts: 52
Thanks Innes I did that however like I said I had issues as my background is an Actor as well. So I need to do it via group but it was giving me issues. I took a day break to do some real life things! Will try to tackle this after dinner tonight!


dripple

  • Posts: 748
You can either try it by group (that's what I do, as my Actors are organized in different groups) or just add an IF statement into the loop that Innes  showed to you:
Code: [Select]
for each [actor on screen]
  if  not [type of [acton on screen]] == [background]
     kill [actor on screen]
Sure, my games won't get better with all the new features of Stencyl.
But I do have more fun creating bad ones.


MayazCastle Keeper