Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Forming scene according to an object — Gideros Forum

Forming scene according to an object

tugbakayatugbakaya Member
edited January 2013 in General questions
Is there any way to forming scene according to and object. I mean how many object ı have ı dont know. any number could be and ı want a scene that for any object, it will generate a scene which depends on its attibutes. for example many books ı have. when ı click anyone, a scene changes and form the title, a picture or something. To sum, ı am trying to find a way to send argument to scene manager.

Comments

  • ar2rsawseenar2rsawseen Maintainer
    edited January 2013
    So basically you want to create scenes with dynamic contents (by passing values to a new scene).

    This is possible with a modification of SceneManager by @ndoss
    https://github.com/ndoss/Scene-Manager

    where you can pass the data as the additional table argument:
    sceneManager:changeScene("scenename", 1, transition, easing.outQuadratic, { userData = {data1 = "data", data2 = "data"}} )
    And retrieve it as an argument passed to contructor:
    function Scene1:init(t)
    	if t then
    		print(t.data1, t.data2)
    	end	
    end
  • hi, ı tried what you say, but when ı tried this ı am giving nil value.
  • MyRoot = Root:init{name = "MyRoot" , image = "images.jpg"}


    sceneManager:changeScene("root_scene", 1, SceneManager.flipWithShade, easing.inOutQuadratic, {MyRoot = {name = MyRoot.name, MyRoot.child, MyRoot.image, MyRoot.icon, MyRoot.type, MyRoot.add_prop}})
  • function root_scene:init(param)
    if param ~= nil then
    print(param.name)
    end
  • twisttaptwisttap Member
    edited January 2013
    sceneManager:changeScene("scenename", 1, transition, easing.outQuadratic, { userData = {name = MyRoot.name, MyRoot.child, MyRoot.image, MyRoot.icon, MyRoot.type, MyRoot.add_prop } } )
    it should be.

  • it is still nil .
  • Can you paste a bigger chunk of code maybe ?
  • ar2rsawseenar2rsawseen Maintainer
    edited January 2013
    are you sure you are using @ndoss modified SceneManager version and not original Gideros version?
  • in my main
    function()
    local transition = transitions[math.random(1, 4)]
    local c = MyRoot.name
    print("before sent ")
    print(MyRoot.name)
    sceneManager:changeScene("root_scene", 1, transition, easing.outQuadratic, { userData = {name = MyRoot.name, MyRoot.name, na = c, c, MyRoot.type, MyRoot.add_prop } } )
    end)


    in my class

    function root_scene:init(param)
    --if param ~= nil then
    print("first value")
    print(param.name)
    print("second value")
    print(param[1])
    print("third value")
    print(param.na)
    print("forth value")
    print(param[3])
    end

    ı am using exactly this code. but all possible values are return nil
  • Can you open scenemanager.lua and tell us what version are you using ?
    It should start with something like:
     
    --[[
    SceneManager v1.0.4
     
    changelog:
    ----------
     
    v1.0.4 - 08.04.2012
    Added option to filter a list of events during transitions
    Moved increment of time to end of onEnterFrame so that time goes from 0 to 1
    Added additional "real time" argument to dispatched transitions 
    Added option to pass user data to a scene when it gets created
  • Before checking the version, I think you should pass your variables like
    var1 = value, var2 = value, var3 = value, etc...
    In your code I see some values without a var or vice versa.
  • ı am using SceneManager v1.0.3
    . Should ı change it?
  • Yes you should use 1.0.4 to pass userData :)
  • thank you so much :)
Sign In or Register to comment.