Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
is scene transitions supported? — Gideros Forum

is scene transitions supported?

alexzhengalexzheng Guru
edited November 2011 in General questions
gideros is a greate tools for making mobile games, it's easy and fast.
I made a simple puzzle game with several scenes,
such as main menu, game scene, help screen and pause screen and so on
I can not find any sample code about scene transitions, so I have to make each screen as a sprite and use addChild and removeChild on stage for translate from one screen to another, I kown it's not the right way.

and by the way,on the faq page
4. How do I evaluate Gideros Studio? You can download Gideros Studio and run it on any machines. Using Gideros Studio is free. When you use a free Gideros Studio, deployed applications will show a Gideros Studio Splash when they are run on a real device.

I deployed my app to my iphone, but no Gideros Studio Splash show when I lunch my app, is the Splash need to add maually?
Tagged:

Comments

  • gorkemgorkem Maintainer
    You do not need to put a splash screen at all at the moment, as it's a planned featured as soon as there's a paid version.

    However we'd be more than glad if you write something like "Made using Gideros Studio" inside your game, and mention about us. ;)
  • could you show me a right way to translate scence
  • atilimatilim Maintainer
    If you can wait for a couple of days, I can show you a good way to translate scenes.
  • I will be glad to wait and refactor my code then,since put all sprite on the stage is terrible for extention
  • I'd be really happy to see this transition example too !

    Thanks.
  • gorkemgorkem Maintainer
    Atilim I can't wait to see either! \:D/
  • atilimatilim Maintainer
    edited November 2011
    Hi,

    I've coded a simple scene manager class. Here is the download link: http://dl.dropbox.com/u/684866/Scene Manager.zip
    http://dl.dropbox.com/u/684866/Scene Manager v1.0.1.zip
    (edit: with v1.0.1, collectgarbage() is called at the end of transition)

    It supports 21 transition types, easing functions and transition begin/end notifications.

    And here are the usage steps:

    1. For each of your scene, derive a class from Sprite (and preferably put them into separate .lua files):
    Menu = gideros.class(Sprite)
    Game = gideros.class(Sprite)
    EndScene = gideros.class(Sprite)
    2. Create a SceneManager instance and while creating pass a table with keys as scene names and values as your classes:
    local sceneManager = SceneManager.new{
        ["menu"] = Menu,
        ["game"] = Game,
        ["endScene"] = EndScene,
    }
    stage:addChild(sceneManager)
    3. Change between scenes with function SceneManager:changeScene(sceneName, duration, transition, ease) like:
    sceneManager:changeScene("game", 1, SceneManager.moveFromTop, easing.linear)
    4. Also SceneManager dispatches events "transitionBegin", "transitionEnd", "transitionInBegin", "transitionInEnd", "transitionOutBegin", "transitionOutEnd". You can register to these events to begin/end your animations, clear your timers, save the scores, etc... You can look at the example to understand these events in a more detail.

    Hope you like it :)

    Likes: Stoffe

    +1 -1 (+1 / -0 )Share on Facebook
  • alexzhengalexzheng Guru
    edited November 2011
    hi
    atilim
    great future!
    I can't open the link,could you send a copy to my email.


    before that,I do a scence translation by translate the new sprite to stage using a gtween and remove the old sprite in the callback
  • atilim,

    That is a great little library, but I have a question.

    Is there a way to make it so it loads a "menu" screen initially, and how would one remove the buttons on transition, to be replaced with other versions on each screen. (Such as going from a main menu to a settings menu, or the actual game.)

    Thanks!

    I've only recently dug into Gideros, but so far I'm enjoying it!
  • atilimatilim Maintainer
    edited November 2011
    @alexzheng
    Your way of using GTween is totally ok.

    @Fedoranimus
    After you create the SceneManager, call its changeScene("menu") function to display the menu screen (If you named your Menu Sprite as "menu")

    I prefer to design each screen as a different Sprite (they can share a common background) and let SceneManager do the transitions and add/remove the sprites. Optionally you can put a background behind and put SceneManager on top of it.

    I'm glad you like it :)
Sign In or Register to comment.