Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
method 'changeScene' (a nil value) [Problem] — Gideros Forum

method 'changeScene' (a nil value) [Problem]

ozergulozergul Member
edited April 2016 in General questions
Hi
I am getting this error.
main.lua:20: attempt to call method 'changeScene' (a nil value)
This are my main.lua codes:
SceneManager = gideros.class(Sprite)
 
sceneManager = SceneManager.new({
	["mainmenu"] = mainmenu
})
 
stage:addChild(sceneManager)
 
 
-- show main menu
sceneManager:changeScene("mainmenu", 1, SceneManager.moveFromRight, easing.outBack)
 
 
-- main menu sceene init
mainmenu = gideros.class(Sprite)
function mainmenu:init()
	local a = Bitmap.new(Texture.new("ball.png", true))
	self:addChild(a)
end

Also I am includeing scenemanager.lua, easing.lua and gtween.lua

What is the problem..

Comments

  • piepie Member
    Hi @ozergul I think that your problem is
    SceneManager = gideros.class(Sprite)
    because it's overwriting the "real" SceneManager (contained in scenemanager.lua) with a Sprite (core class) which doesn't have changeScene method. (just remove it, unless I didn't notice something else it should work).

    Also, you should not use gideros.class to create objects, but Core.class(Sprite) ie. to create a Sprite - it should work anyway but the current syntax uses Core.class() :)

    Likes: antix, greengeek

    +1 -1 (+2 / -0 )Share on Facebook
  • antixantix Member
    Yep, remove the first line of code.
Sign In or Register to comment.