static varibles on objects

0 favourites
  • 4 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • We need static variables for object types. Both for families and object types. Why no exist?

    I am referring to static as defined by programers, not construct 2.

    https://www.google.com/search?q=static+ ... 8&oe=utf-8

    "A static variable is one that's associated with a class, not objects of that class..."

    In other words, if you set an objects static variable it will be reflected across all instances of that object.

  • Pretty sure instances variables are static (since they are not resetted every tick).

    Maybe you want the opposite?

  • Could always set the val to 0 at the bottom of the sheet or event.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Tokinsom Aphrodite - Thanks for the reply. I didn't think to mention I was referring to static variables as is defined by programing. I forgot that construct 2 has "static" variables. A bad name to use when the programing world already uses "static" to define a variable that is attached to the object rather than the instance of that object. Basically, if you change a static variable on an object, regardless from which instance you accessed it, it reflects across all instances of that object. Its kind of like a global variable but for only the instances from the object that has it.

    I updated the OP to reflect this.

    If you had a mob of enemies that react as one, you could have a static variable "IsAlert". If the player overlapped a trigger object, you could set IsAlert to true on one instance of the enemy object type. At this point all of those enemies would have "IsAlert" as true. It is much better than using a global variable to do the same thing.

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