Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Scene manager-no such thing as "easing.outback" — Gideros Forum

Scene manager-no such thing as "easing.outback"

ZizanymanZizanyman Member
edited February 2015 in General questions
I am using scene manager ( I made sure to add the scene manager code as SceneManager.lua) , and when I use this line, it comes out with an error:

sceneManager:changeScene("start", 1, SceneManager.moveFromRight, easing.outBack)

This is the error:

main.lua:7: attempt to index global 'easing' (a nil value)
stack traceback:
main.lua:7: in main chunk

If anybody could explain what "easing" is and why it comes up with an error, that would be great. :)

Comments

  • You need easing.lua file
    lua
    lua
    easing.lua
    5K
  • ZizanymanZizanyman Member
    edited February 2015
    @jdbc All right, that fixed that problem, now it says:

    SceneManager.lua:266: attempt to index field '?' (a nil value)
    stack traceback:
    SceneManager.lua:266: in function 'changeScene'
    main.lua:7: in main chunk
  • Are you sure you defined the scene before changing to it?
    It seems that you are trying to change a scene that is not existed.
  • ZizanymanZizanyman Member
    edited February 2015
    @jdbc and @talis I'm pretty sure I'm following the tutorials the right way. Here is my entire code:

    sceneManager = SceneManager.new({
    ["start"] = start,
    ["mode_select"] = mode_select
    })
    stage:addChild(sceneManager)

    start = gideros.class(Sprite)
    sceneManager:changeScene("start", 1, SceneManager.moveFromRight, easing.outBack)

    function start:init()
    local background = Bitmap.new(Texture.new("Space_Background.jpg"))
    stage:addChild(background)
    end
  • yubaroyubaro Member
    Accepted Answer
    Try this:

    main.lua
    sceneManager = SceneManager.new({
    ["start"] = start,
    ["mode_select"] = mode_select
    })
    stage:addChild(sceneManager)
     
    sceneManager:changeScene("start", 1, SceneManager.moveFromRight, easing.outBack)
    start.lua
    start = gideros.class(Sprite)
     
    function start:init()
    local background = Bitmap.new(Texture.new("Space_Background.jpg"))
    self:addChild(background)
    end



  • Thanks so much @yubaro! :D I guess I have to make a different file for the different scenes.
  • hgy29hgy29 Maintainer
    @Zizanyman, @yubaro solution is indeed the cleanest way to go, one don't want to put everything in main.lua, but your issue lies in the order of the declarations in your main.lua. For instance, in your code your give to the SceneManager a start variable that has no value yet.

    Writing your code as:
    start = gideros.class(Sprite)
    sceneManager:changeScene("start", 1, SceneManager.moveFromRight, easing.outBack)
     
    function start:init()
    local background = Bitmap.new(Texture.new("Space_Background.jpg"))
    stage:addChild(background)
    end 
     
    sceneManager = SceneManager.new({
    ["start"] = start,
    ["mode_select"] = mode_select
    })
    stage:addChild(sceneManager)
    would have done the trick too. @yubaro solution works because main.lua is guaranted to always be the latest lua file parsed.
Sign In or Register to comment.