Change Scene Behavior - Bug !?

SandbirdSandbird Member Posts: 69
edited January 2012 in Working with GS (Mac)
I saw a nice function in FreeCoverFlow by @Tshirtbooth that he had the buttons sending the preferred level selection to a game attribute and then load a default scene from where (my guess is) the levels were loaded....I tried to make a simple version of that function in the example bellow but for some weird reason Change Scene behavior isnt working.
Can someone please take a look at the project below. It a simple version of what i am facing.
The 2nd scene does grab the game attribute the user selected, but it wont change the scene to the preferred number. Its really weird.
Thanks

http://www.mediafire.com/?a39a8e6lvg5g5ln

Comments

  • POMPOM Member Posts: 2,599
    edited January 2012
    Changing 2 scenes in order to get to the scene you want is a big NO NO , and i don't recall seeing this in any of TSB's Templates .
    If you have a " preferred level selection" attribute , then simply in your button make a rule-
    Touch is pressed:
    If "game.preferred level selection" = 1
    go to scene 1
    If "game.preferred level selection" = 2
    go to scene 2
    If "game.preferred level selection" = 3
    go to scene 3

    And on and on .

    Cheers.
    Roy.
  • SandbirdSandbird Member Posts: 69
    edited January 2012
    In the cover flow on the main actor you have Go to Scene: 1 in the prototype.
    You are holding the "selected level" in a variable and all buttons have goto scene 1.
    I thought that in that scene you'd grab the variable and do the magic switch. (made sense to me since we do stuff like that with PHP all the time :P).
    This way instead of editing every button you have them all go to the same place sending the game variable as well...its like saying: /scene.php?lvl=2
    But, i understand what you guys are saying...i just tried to be all Object Oriented on it :P

    But how come this is not working anyways ?
    The 2nd scene has the value at hand, and i just do a Rule check and forward the user to the other lvl. Why is it getting stuck there?
  • POMPOM Member Posts: 2,599
    Yeah thats a bug , GS is buggy when there are rules that are triggered at the moment the scene is up , putting a delay (timer) will solve this for you ,
    Timer - after 0.1 sec
    Game.lvlvselect = 2
    go to scene 2

    Roy.
  • SandbirdSandbird Member Posts: 69
    oh i got it...yeah with a small timer it works. Its because GS doesnt load stuff in order using some hierarchy.
    Putting a timer delays the behavior until everything is loaded properly.
    Thanks :)
Sign In or Register to comment.