How do I do that a variable couldn´t go under 0

Get help using Construct 2

Post » Mon Nov 10, 2014 4:58 pm

How do I do that a variable couldn´t go under 0
Thanks a lot
B
3
Posts: 7
Reputation: 189

Post » Mon Nov 10, 2014 5:10 pm

If variable <0 set variable to 0.
B
33
S
9
G
3
Posts: 493
Reputation: 4,042

Post » Mon Nov 10, 2014 5:16 pm

but i want to use it to pay or so and if i do it on this way u can buy so much u want
B
3
Posts: 7
Reputation: 189

Post » Mon Nov 10, 2014 5:21 pm

how much you can buy... for zero euros?
Image
B
65
S
23
G
7
Posts: 1,505
Reputation: 10,896

Post » Mon Nov 10, 2014 5:28 pm

if u have zero u can buy so much u want and than it is -100 or so and i want thaz u only can buy something if u have enough money u know?
B
3
Posts: 7
Reputation: 189

Post » Mon Nov 10, 2014 6:13 pm

No, I don't know. Can you rephrase that? I couldn't understand what you're trying to say.
B
33
S
9
G
3
Posts: 493
Reputation: 4,042

Post » Mon Nov 10, 2014 6:30 pm

i create a game where u can buy something with the coins from the game and if u have for example 10 coins and buy something for 100 coins u have -90 coins. now i want that u cant buy this if u have not enough money.
B
3
Posts: 7
Reputation: 189

Post » Mon Nov 10, 2014 7:03 pm

Just check if the cost is less than or equal to the amount of money before buying.

ex.

money >= cost
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959

Post » Mon Nov 10, 2014 7:17 pm

....
You do not have the required permissions to view the files attached to this post.
Image
B
65
S
23
G
7
Posts: 1,505
Reputation: 10,896


Return to How do I....?

Who is online

Users browsing this forum: Exabot [Bot], FacuLNF and 69 guests