How to switch to next scene after finished?

Winkley

  • Posts: 22
I'm working with the Brick Block example game, how can I create something (actor, behavior, etc.) that will automatically switch the level after all the blocks are gone

Greg

  • *
  • Posts: 1260
The gist of it would be -

1) Create a number attribute, at the start of each frame (always block) set it to 0.
2) Use the "for each member of [blocks]" (or whatever the collision group for your blocks is)
3) Inside that, increment your number attribute by one.
4) Outside of that, check if your number attribute is greater than 1 (if so, you're not ready to transition).
5) If it's 0 - use the "Switch scene" block.

If you have an trouble finding these blocks, let us know.  They're mostly under the Scene category. 

Winkley

  • Posts: 22
The gist of it would be -

1) Create a number attribute, at the start of each frame (always block) set it to 0.
2) Use the "for each member of [blocks]" (or whatever the collision group for your blocks is)
3) Inside that, increment your number attribute by one.
4) Outside of that, check if your number attribute is greater than 1 (if so, you're not ready to transition).
5) If it's 0 - use the "Switch scene" block.

If you have an trouble finding these blocks, let us know.  They're mostly under the Scene category.

I don't understand the bold part.

Joe

  • *
  • Posts: 2480
He's saying use a "set [attribute] to 0" block at the top of the Always event wrapper.

Winkley

  • Posts: 22
And where's that?

:3

Joe

  • *
  • Posts: 2480
Under Attributes? I don't have StencylWorks on me right now. Try searching for "set" using the search box in the Design Mode block palette.

Winkley

  • Posts: 22
When I add my attribute these fields pop up:

Name:
Category: Default

Type: Number Text Boolean(Yes or No) List
Initial value: 0

Should anything different be filled in those fields?

Luyren

  • *
  • Posts: 1843
You're trying to create a Game Attribute. What they meant was creating an actor attribute. In your behavior, go to the attribute's tab and click in create new attribute.
I have my Stencyl resources available here: https://luyren.itch.io/

Winkley

  • Posts: 22
I've finally found the tab.
Going to see if it works out

Winkley

  • Posts: 22
I'm having a bad day...

Could someone please take a screenshot of how it should look?


Sorry about the double post.

Greg

  • *
  • Posts: 1260
Have a look at this thread -

http://community.stencyl.com/index.php/topic,1647.msg11952.html#msg11952

replace the print block with an IF check.  If, # of blocks is 0, switch scene.

Winkley

  • Posts: 22
This is what I've got so far...

Greg

  • *
  • Posts: 1260
If number_attribute = 0, switch scene

Winkley

  • Posts: 22
Is that one of the comparisons?

coleislazy

  • *
  • Posts: 2607
You'll need to grab an <anything = anything> block to put in the if block and then put number_attribute on one side and 0 on the other.