Understanding global objects

0 favourites
  • 6 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • Hi all,

    Just wondering if anyone might be able to help me out, I'm certain i am using the global objects wrong but i cant understand it.

    Say you have an object that is global, when you destroy that object, no issue, but when you go to a new layout if you dont destroy the object on the previous layout, it shows up & i just cant understand why, any help here greatly appreciated,

    Regards, hope everyone is well.

    Dax.

  • if you don't destroy the object on the previous layout, it shows up & i just cant understand why

    Because it's global :)

    From the documentation:

  • So i understand that i think, the purpose for making them global is, they respawn/reset when i return to the previous layout, which i don't want.

    Do you think it would be wiser to set the object's into another state and make them non global?

  • My issue is i have loot spawning on destroy, and i don't want the player to be able to move between layout's farming the loot.

    Setting the object to global fixes this because i want the object to remain destroyed, but in the event the player misses one or doesnt destroy it, it shows up (and i know this is as intended lol) i should find another way to turn the loot spawn off.

  • I think what you are looking for is Persist behavior. Read about it in the documentation:

    construct.net/en/make-games/manuals/construct-3/behavior-reference/persist

    Don't set objects global unless you need to have the same object instance in multiple layouts. I very rarely use global objects in my games.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Derp, thank you!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)