Scene Transitions

osucowboy18osucowboy18 Member Posts: 1,307
edited November -1 in Working with GS (Mac)
Does anyone know the easiest way to create scene transitions in GameSalad? I'm not looking for anything fancy, just a simple transition like a fade to black or fade to white transition. Thanks.

- Alex

Comments

  • GamersRejoiceGamersRejoice Member Posts: 817
    One easy thing to do is to make an actor the size of the full screen and then control it's alpha using interpolate. It looks something like this:

    Interpolate: self.color.alpha to 1, or 0 to have it transparent.
  • VoidedSkyVoidedSky Member Posts: 1,095
    Hi.

    Make an actor named "Transition"
    Make an attribute called game.transition in global attributes: a BOOLEAN attribute
    When game.transition is TRUE, Then it will transition.

    THIS CODE WILL TRANSITION FROM ALPHA TO BLACK, OR WHITE
    Now. The following should be in the actor:

    NOTE: USE 1 INSTEAD OF 0 IN THE NEXT 3 LINES TO MAKE IT TRANSITION TO WHITE

    -Change attribute self.color.red to 0
    -Change attribute self.color. green to 0
    -Change attribute self.color. blue to 0

    --Change attribute self.color. alpha to 0

    NOTE: TO TRANSITION BACK IN, INTERPOLATE TO 0 FROM 1

    --Rule: When game.transition = true
    ---Interpolate: self.color.alpha to 1; duration 2.5 seconds
    --Otherwise: Change attribute self.color. alpha to 0

    /END CODE

    I hope this helped!
    Just ask if you don't understand.

    ~CTM
  • osucowboy18osucowboy18 Member Posts: 1,307
    Thanks for such a detailed answer CTM. Correct me if I'm wrong but whenever I want to change scenes and I call the "Change Scene" behavior, is that where I would change game.Transition to true? Also, to avoid an infinite loop, where and when would I change game.Transition back to false so it doesn't keep fading. Thanks again for all your help.

    - Alex
  • VoidedSkyVoidedSky Member Posts: 1,095
    Call the transition behavior, then after that, put a timer, after 2.5 seconds change attribute game.transition to false, and change scene. I hope that helps!
    ~CTM
  • osucowboy18osucowboy18 Member Posts: 1,307
    Ok thanks. In the code you posted earlier, will that just fade out of a scene, or will it fade out of one scene and then after the scene has been changed, will it fade into the new scene. Also, I assume I will have to have the actor "Transition" in all of my scenes, correct? One more question, does the actor Transition need to take up the full screen of each scene, and does it need to be a certain color, or just transparent? Thanks again.

    - Alex
  • VoidedSkyVoidedSky Member Posts: 1,095
    FADE OUT TO BLACK:

    /CODE/

    NOTE: USE 1 INSTEAD OF 0 IN THE NEXT 3 LINES TO MAKE IT FADE TO WHITE

    -Change attribute self.color.red to 0
    -Change attribute self.color. green to 0
    -Change attribute self.color. blue to 0

    --Change attribute self.color. alpha to 0

    --Rule: When game.transitionOut = true
    ---Interpolate: self.color.alpha to 1; duration 2.5 seconds
    --Otherwise: Change attribute self.color. alpha to 0

    /END CODE/

    FADE IN FROM BLACK:

    /CODE/

    NOTE: USE 1 INSTEAD OF 0 IN THE NEXT 3 LINES TO MAKE IT FADE IN FROM WHITE

    -Change attribute self.color.red to 0
    -Change attribute self.color. green to 0
    -Change attribute self.color. blue to 0

    --Change attribute self.color. alpha to 1

    --Rule: When game.transitionIN = true
    ---Interpolate: self.color.alpha to 0; duration 2.5 seconds
    --Otherwise: Change attribute self.color. alpha to 1

    /END CODE/

    You need a FADE IN actor and a FADE OUT actor in each scene. They need to be as big as the camera view.
    The following is how you use them:

    Change Scene Button:
    /CODE/
    --When touch is pressed:
    ---Change attribute game.transitionOut to TRUE

    --Timer: after 2.5 seconds:
    ---change game.transitionOut to FALSE
    ---Chang Scene.....
    /END CODE/

    SCENE CONTROLLER(This needs to be in EVERY SCENE for the fade in to work!!)

    /CODE/
    --Change Attribute game.transitionIN to TRUE

    --Timer:
    ---After 2.5 seconds change attribute game.transitionIN to FALSE
    /END CODE/

    This code Should work. I hope you can understand this;-)
    ~CTM

    /END CODE/
  • joshmiller602joshmiller602 Member Posts: 206
    Great details CTM. Doing a transition is not something I had thought about before either osucowboy. Very nice...
  • VoidedSkyVoidedSky Member Posts: 1,095
    Glad you like it! It can come in handy for other things like a nuclear explosion. Well I hope you use it!
    ~CTM
  • osucowboy18osucowboy18 Member Posts: 1,307
    Thank you SO much CTM! That makes perfect sence. I owe you one.

    - Alex
  • VoidedSkyVoidedSky Member Posts: 1,095
    Hey, no problem!
    Merry Christmas!
    ~CTM
  • osucowboy18osucowboy18 Member Posts: 1,307
    Hey CTM, have you by any chance already done this in a GS project? I tried implementing the code you posted earlier, and I successfully got the "Fade Out" behavior to work, but not the "Fade In" behavior. Would it be possible for you to email me a GS project of using the Fade In and Out behaviors?

    Thanks.

    - Alex
  • VoidedSkyVoidedSky Member Posts: 1,095
    Email me at: MyGSUSername at gmail.com
    I will probably send it out in the morning.
    ~CTM
  • osucowboy18osucowboy18 Member Posts: 1,307
    CTM, I tried emailing you at the address you specified, but I got a "Mail Delivery Error". In case that was the wrong address, you can email me the GS project at iphoneapps@alexharbaughapps.com. Thanks again.

    - Alex
  • VoidedSkyVoidedSky Member Posts: 1,095
    Just emailed you, Anyone else want a Transition Demo?
    ~CTM
  • simo103simo103 Member, PRO Posts: 1,331
    sure think CTM .. thanks

    simon(AT)resqwest.NET
  • osucowboy18osucowboy18 Member Posts: 1,307
    Hey CTM, just got your email, I will look through it and make sure I understand everything :) Thanks again and Merry Christmas!

    - Alex
  • beefy_clyrobeefy_clyro Member Posts: 5,394
    Yeh would like to check i out :)

    keith (at) kc8(dot)com
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    Nice ctm!

    To add to what he made you could put 3 interpolate behaviors in with the touch that triggers CTM's fade. Interpolate camera size width and camera size height to 0, and interpolate camera rotation to 360, and it will rotate while zooming into a fade.

    Hope you dont mind me adding to this CTM, i just thought it might be useful to some people
  • VoidedSkyVoidedSky Member Posts: 1,095
    @John: Nice additions!
    @beefy_clyro, For some reason, the message came back to me, can you just email me?
    MyGSUserName (at) gmail (dot) com

    ~CTM
  • mumblyanalogmumblyanalog Member Posts: 11
    Hi,

    Sorry to bother you all, is it possible for one of you with transition working
    to email me a working sample ?

    Many thanks.

    You can mail me at : ios.b4sleep (at) gmail.com

    Thanks again !
  • oldieoldie Member Posts: 4
    Thanks CowTechMan for the tip!
  • osucowboy18osucowboy18 Member Posts: 1,307
    mumblyanalog said:
    Hi,

    Sorry to bother you all, is it possible for one of you with transition working
    to email me a working sample ?

    Many thanks.

    You can mail me at : ios.b4sleep (at) gmail.com

    Thanks again !

    Has someone already emailed you a demo yet? If not, let me know and I would be happy to do so.

    - Alex
  • Field305Field305 Member Posts: 29
    This would be very helpful for me, can someone please e-mail to me, also thank you for the time and effort to make this in advance, Field305 (at) yahoo.com
  • jjacobsonjjacobson Member Posts: 1
    osucowboy18 said:
    Has someone already emailed you a demo yet? If not, let me know and I would be happy to do so.

    - Alex

    hey can you please send me a copy @ j.jacobson966@gmail.com Thanks in advance!
  • anithmukanithmuk Member Posts: 235
    Hey, thus sound great! If you could email me a demo that would be nice :)

    anithmuk@hotmail.com
Sign In or Register to comment.