Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Messages How to? — Gideros Forum

Messages How to?

gianmichelegianmichele Member
edited August 2012 in General questions
Thanks to the community I have finally solved (and understood) my previous memory leak problems.

I have another question: I have a series of game objects that get spawned in the scene and upon collision this objects needs to send a message to the main game loop that will handle a complex logic.

I though about a custom event on the the game objects that triggers a listener in my main game loop but apparently I need to add the listener to my objects and cannot add it somewhere else.

Any idea?

Comments

  • talistalis Guru
    edited August 2012
    Ok maybe it will be so much simple idea and can not be implemented in your game because of your complex logic in the main loop. But anyway i will shoot it:D
    -What about some global boolean variables or not boolean any kind of global variable, in collusion of objects you will change these global values and in your main game loop you will check these global variables and with simple if clauses you will change the logic of the game.

    Of course from your post i can not understand what you want to do actually so i am handling the problem as simple as it can be:) (Simplicity is the best solution always, of course if it is a solution) :D
  • Similar as @talis mentioned, you can store booleans as main game logic class properties. As I understood your only problem is that you can't access main loop class from game object class and vice versa.

    But is game object a child of game loop? You can retrieve game objects parent if that helps, using getParent() method and then set its boolean property.

    But its really hard to tell without knowing the structure and hierarchy of your project
  • I agree with @talis and @ar2rsawseen, using global boolean or global function could solve the problem. IMO, dont feel too bad when using globals especially in game, you could refactor your code after it works first :)
    have fun with our games~
    http://www.nightspade.com
  • Thanks guys...yep solved by using a global boolean.
Sign In or Register to comment.