Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Why Scene Manager Changes Scenes Correctly and then Incorrectly? — Gideros Forum

Why Scene Manager Changes Scenes Correctly and then Incorrectly?

GiliappsGiliapps Member
edited October 2015 in Bugs and issues
Hi there!
Sorry for my language!!!
I am developing a Hidden Objects Game with 54 scenes. When check it in Player or my Device, scenes changing correctly some times and then changing incorrectly. Why?
I attach Main file and one of the Scenes to this post.
Please help me to solve this problem.
Thanks a lot dear friends :-)
lua
lua
main.lua
2K
lua
lua
scene19.lua
12K

Comments

  • Question, what exactly it does incorrectly? :)

    Likes: Giliapps

    +1 -1 (+1 / -0 )Share on Facebook
  • GiliappsGiliapps Member
    edited October 2015
    Hi dear @ar2rsawseen.
    For example when I tap on Back, moves to scene 18 correctly, then in next test, moves to scene 4 ???

    Is these reasons are possible:
    1- Use GC in start of scenes
    2- Use same name Vars in scenes (I declare them in start of scene, then NIL them in end of scenes)
    3- Use Timers for Hint (In Hidden Objects Games, for help to gamers to find things) and conflict it with Scene Manager

    Thanks again :-)
  • piepie Member
    Accepted Answer
    Hi, I don't know if that could be the reason, - I don't think so - but I noticed that you're using gideros.class(Sprite) -the old way- instead of Core.class (Sprite)

    I believe that the problem is somewhere in your code, maybe some Var is not annihilated in time?
    I didn't check your work, but there could be some time when both scenes coexist (during transition from one to the other).

    To avoid the "overlapping" of Vars values you could set them as properties of each scene and see if the problem persists.
    You could also try monitoring (print) the vars values before and after scene transition to check if this may be your issue.

    Likes: Giliapps

    +1 -1 (+1 / -0 )Share on Facebook
  • Hi @pie
    Thank you so much.
    I try replace gideros.class with Core.class in every scenes, but my problem is not solve yet.
    But your recommendation about test print(var) shows that my Vars is still in memory after NIL them!!! I guess that it is my issue.
    I am changing name of them in every scenes. This is take much time. I will say about result to you.
    Thanks again :-) :-)
  • totebototebo Member
    edited October 2015
    I can dearly recommend using Strict.lua, which creates a compile error if you try to assign a value to a global var without first declaring it. I've attached the file to this post. Just add it to your project and you're good to go.
    lua
    lua
    Strict.lua
    954B

    Likes: Giliapps

    My Gideros games: www.totebo.com
    +1 -1 (+1 / -0 )Share on Facebook
  • piepie Member
    @Giliapps I think you're doing it the hard way :) you can also nil your vars at the beginning of every scene instead of doing it at the end - if you still want to use globals.

    I didn't know about strict lua, it seems to be an excellent idea to keep things clean: from my understanding it is wise to avoid global vars anywhere it is possible.

    Likes: Giliapps

    +1 -1 (+1 / -0 )Share on Facebook
  • GiliappsGiliapps Member
    edited October 2015
    Hi dears @pie, @totebo, @ar2rsawseen
    Thanks all.
    I can't use recommendations of Strict.lua because my HINT functions (in a separate and important lua file) checks every vars in every scenes to help gamers to find things and ways and ...
    But changing name of vars to unique names, solve my problem. (Special thanks to @pie)
    I complete this game (with name: WILLIHARD (Collector's Edition - Full Hidden Objects)) just now. [-O<
    Thanks to all my dear friends :-) :-) :-) and good luck.
Sign In or Register to comment.