Instance Variables & Enemy Health

0 favourites
  • 6 posts
From the Asset Store
Be discreet and rescue your friends from behind enemy lines.
  • I just realized, if I have one of these enemies show up, will it inadvertently heal all other instances with this command?

    How can I tell if I'm affecting one or all instances of something, and how can I make sure I'm affecting one- or all instances of something?

  • Just set the default HP of each at your project page.

    All future Baddy_Buds spawned will yield the default HP.

  • Solid advice, thanks; I'll implement it right away.

    Still, it doesn't answer my question. I'd like to know how to tell whether this statement (and similar) affect one or all instances, and how to make sure I can do whichever I need.

  • ShinjiDammit in your example only the Baddy_Bud that is being created will be affected, as it is the only one that is picked.

    You use the conditions to select the objects to which you want to apply the following actions. For example:

    SpriteA Compare Height > 50: SpriteA Set width to 100

    ...will pick all spriteA instances with a height greater than 50 and change their width to 100. All SpriteA with their height equal to or less than 50 will be unaffected.

    SpriteA Compare Height > 50

    >SpriteA Compare value Animal = "chicken": SpriteA Set width to 100

    ...will first pick all spriteA instances with a height greater than fifty, then from that group all SpriteA whose instance value Animal equals "chicken" and then change their width to 100. All SpriteA with their height equal to or less than 50 or whose Animal is not "chicken" will be unaffected.

    You can use nested conditions like this to narrow down the size of the group that will be affected by the actions.

    If you refer to an object type in the actions without specifying any conditions that pick instances of that object then all instances of that object will be picked:

    SpriteA Compare Height > 50

    >SpriteA Compare value Animal = "chicken": SpriteA Set width to 100; SpriteB Set width to 100

    ...all of SpriteB instances will be affected and have their width set to 100.

    Sometimes, after applying lots of selection conditions to narrow down your group of objects, you may want to reselect all members of that object type in a sub-event; in that situation you can use the system condition: "Pick All".

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • And read the manual entry blackhornet linked to!

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