"On Variable Changed [Increased/Decreased]" Condition

Get help using Construct 2

Post » Sun Mar 22, 2015 8:35 am

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.
Posts: 6
Reputation: 212

Post » Sun Mar 22, 2015 9:29 am

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
Game design is all about decomposing the core of your game so it becomes simple instructions.
Posts: 2,123
Reputation: 17,200

Post » Mon Mar 23, 2015 1:58 pm

Hey Aphrodite -
Yeah, I've figured that that'll be the easiest way to go right now. Thanks :)
Posts: 6
Reputation: 212

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 1 guest