What's the best way to make a switching button?

ozz

  • *
  • Posts: 575
I have a button I want to use for duel switching, between page 0 and Page 1, but the snippet you see bellow doesn't work all that well.  What's an effective way to do this?

z26

  • Posts: 21
I think a bit more context would be helpful.

ozz

  • *
  • Posts: 575
Sure, I have a button in a scene.  I want it  to switch to Page 0 when it's on Page 1 and to Page 0 when it's on Page 1.  Basically a button that sets a number variable to X if it's Y or Y if it's X.

playtheHnote

  • Posts: 395
put a stop block in the if check part and try (below the timer)
Check out my instrumental rock album "Hail to the Chosen One" at: https://soundcloud.com/play-the-h-note

Visit my facebook page @ https://www.facebook.com/justin.shellhorn.1
"Sound King"  now available at the forge see http://community.stencyl.com/index.php/topic,35672.0.html
for more info!

HarryK

  • Posts: 32
Maybe add "click to change scene??"

playtheHnote

  • Posts: 395
And hang on while i figure out whats going on in your game. What is turning pages an actor?
Check out my instrumental rock album "Hail to the Chosen One" at: https://soundcloud.com/play-the-h-note

Visit my facebook page @ https://www.facebook.com/justin.shellhorn.1
"Sound King"  now available at the forge see http://community.stencyl.com/index.php/topic,35672.0.html
for more info!

ozz

  • *
  • Posts: 575
End didn't change anything, I've never been able to use it effectively.
It's within the same scene.
It's a scene using an actor.

letmethink

  • *
  • Posts: 2545
What doesn't work with that snippet? I don't think you need the do after 0.5 seconds wrapper around the block. Try removing it.
~Letmethink

Innes

  • *
  • Posts: 1960
Using two [if] blocks for a toggle is inefficient and prone to errors. Have a look at the following link which explains how to refactor your code to improve toggling.


www.thestencylblog.com/blog/refactoring-code-and-avoiding-errors-in-stencyl

« Last Edit: November 16, 2020, 11:09:52 pm by Justin »
Visit www.TheStencylBook.com - the only published book for learning Stencyl.