Global Variables

  • Hello!

    I have a question about Global Variables.... Can two different instances(Sorry, I meant object types)draw from the same global variable without each other being affected? For example, If I have one enemy with 50 points for health that draws from a G.V. on the event sheet... and I have another on the same layout(two totally different object types)can they "share" the global variable? Or would both suffer damage when only one of them took damage?

  • Use instance variables instead of global variables.

  • Use instance variables instead of global variables.

    Global Variable is used as common variable, while instance variable makes each type or instance has it own variable so when you have like three instance of the same type, when an instance get hit, it will decrease from its own instance variable, while the others remain undamaged. Hope you find it useful.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Also, if you have several objects that need a "health" variable, create a family, add the objects to the family and create a family instance variable. Much easier to work with.

  • KFC Naji

    Appreciate the reply! I see the family option is the most feasible... I guess It's time I get my license for C2 ASAP... I'm missing out on these cool feature using this free version...

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