How do I make a limit on how much HP you earn from an object

Get help using Construct 2

Post » Mon Sep 19, 2016 8:08 pm

Hello, I've today decided to make an item box that creates an object that gives the player HP. The only problem I am having is that out of 100 health points my player has (the item gives 50 hp), it over extends over 100 hp which shouldn't be possible as of yet in my game. So yeah, how do I add a limit on my variables?
B
7
Posts: 26
Reputation: 332

Post » Mon Sep 19, 2016 8:22 pm

This is how I do it, but there might be a better way.

HP is greater than or equal to 100 - Set to 100
(This is a compare variable condition)

Let me know if you need more clarification.
B
7
S
1
Posts: 57
Reputation: 728

Post » Mon Sep 19, 2016 8:49 pm

hp = min(100, hp + 50)
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Tue Sep 20, 2016 9:00 am

jweickum wrote:This is how I do it, but there might be a better way.

HP is greater than or equal to 100 - Set to 100
(This is a compare variable condition)

Let me know if you need more clarification.

It worked perfectly, thank you!
B
7
Posts: 26
Reputation: 332


Return to How do I....?

Who is online

Users browsing this forum: farsen and 20 guests