Last number 0 ?

Get help using Construct 2

Post » Sun Oct 06, 2013 11:44 am

Hello Community,

I have a question, I have at the moment a Ammo system, that means that a Variable is counting for every shoot -1 an when 0 is reached the Player cant fire anymore Ammos.
Now my problem is that the counter is going after 0 to -1, -2, -3 etc.
How can i make it that the last number is 0 ?


Thanks
B
11
S
2
Posts: 93
Reputation: 917

Post » Sun Oct 06, 2013 11:52 am

Add a condition: if variable is > 0
So 1 is only subtracted if the variable is above 0
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Oct 06, 2013 12:12 pm

Can i do this with the Command: "Compare Variable" ??

And when yes, what must exactly in the Box Value ?


Thanks.
B
11
S
2
Posts: 93
Reputation: 917

Post » Sun Oct 06, 2013 12:34 pm

I don't know how you have your events and/or variables set up, so I really can't answer that question without guessing.

To make it easier just do a system compare two values: variable > 0
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Oct 06, 2013 12:41 pm

Would clamp work? - clamp(value,minimum,maximum)

here's a post where somone else asked about something similar:
http://www.scirra.com/forum/clamp_topic55697.html

Here's the manual entry:
https://www.scirra.com/manual/126/system-expressions
near the bottom in "Values"
B
226
S
60
G
33
Posts: 902
Reputation: 39,989


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 12 guests