"On Variable Changed [Increased/Decreased]" Condition

  • Hey there,

    So I'm not sure if I'm overlooking a feature, but I haven't been able to find information on a way to perform a check to see if a variable has been decreased or increased in-game. Essentially, I'm trying to simplify health-decrease events. Right now, when my player is injured, the following actions are performed:

    ] Subtract 1 from PlayerHP [Global Variable]

    ] Player flashes for 0.6 seconds

    ] Play sound

    The issue I'm having is really one of time and bulky coding [I do my best to keep everything as concise and easily-changed as possible]. Having to add the flashing and sounds is tedious, and if I ever want to add other effects to the player's injury (I intend to add different animations and random sounds later on), I will have to go back through each instance of the player's reactions and add the new effects.

    In essence, I'm trying to figure out if there's a way to create a single event which reacts to a decrease in the player's health (any number subtracted from the global variable PlayerHP). That way, I only have to add the ]Subtract 1 from PlayerHP action to the injury events, and all of the player-based reactions can be kept concisely in one, easily-altered event.

    If you have any ideas or if I'm overlooking an obvious feature, let me know! Thanks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I am not sure in your case it is the best way, we never know but maybe one day you will need to reduce the player HP without doing anything, I think perhaps a function that will do those 3 things is a better way to go, as you just have to edit the function once if needed.

    still think your suggestion can be useful though

  • Hey Aphrodite -

    Yeah, I've figured that that'll be the easiest way to go right now. Thanks

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