Random Scene switch [SOLVED]

Genadiy

  • Posts: 12
Hello guys so basically I have a starting scene + 5 other scenes (so 6 all together) when I press the start button on the starting scene  I want a scene behavior to switch  to a random scene, I wrote a code and used examples from other forum posts but so far it's not working properly (when I click the start button the scene does not switch)  Hears a photo of what I got going

« Last Edit: February 25, 2014, 07:03:28 pm by Genadiy »

acarnivorousocean

  • Posts: 194
What sort of code do you have that actually gives [Number] a value?

I would get rid of the [Random number between (?) and (?)] blocks that you have next to your scene transitions.
Try this:

If Mouse is pressed on start button:
   Set [Number] to  [Random number between (?) and (?)]
If [Number] = 1
   Switch to scene with name (?)

etc

etc

Genadiy

  • Posts: 12
Alright sweet it's working, Thanks for the quick response! Hears the code for those who would like to use it or need an example. I hate it when people solve a problem but don't show how they solved it:p

Genadiy

  • Posts: 12
Alright sweet it's working, Thanks for the quick response! Hears the code for those who would like to use it or need an example. I hate it when people solve a problem but don't show how they solved it:p
Opps don't pay attention to the top code pay attention to the bottom one!

acarnivorousocean

  • Posts: 194
Glad to help out!  Thanks for putting the finished code up for others to see.  One more quick thing that will help the newcomers is if you edit your thread title to say [SOLVED] at the end.  Really helps keep threads organized.

Genadiy

  • Posts: 12
No problem and thanks again! Hears the finished code one more time so no one gets confused with the last one I posted

Blacksmith

  • Posts: 142
I think I've done this before and kept the switch to just 1 line.

If <Mouse pressed on> <start button>
     Set NUMBER to [random number between 1 and 5]
     Switch [Scene with name: [TEXT & TEXT]] and slide left for 0.1 secs]

The [TEXT & TEXT] block allows you to concatenate the following text segments together [Scene: ] and [[NUMBER] as text]

Please forgive me if I have a little bit of the syntax wrong, I can't open Stencyl at the moment.