i am creating a idle game, need help !

Just started using Construct 2? Post your questions here

Post » Fri Feb 05, 2016 8:01 pm

hello everyone!

i am creating an idle game, (a game like cookie clicker) and i have a problem, how can i set values/variables so that they cant go negative ?
B
2
Posts: 2
Reputation: 154

Post » Fri Feb 05, 2016 8:14 pm

Add an event to make it so if a variable would go under zero, it makes it zero instead.
Or to the event which substracts the variable, add to the event that it can not be substracted if it it would go under 0.

Image
Last edited by littanana on Fri Feb 05, 2016 8:21 pm, edited 1 time in total.
B
10
S
2
G
1
Posts: 51
Reputation: 848

Post » Fri Feb 05, 2016 8:17 pm

littanana wrote:Add an event to make it so if a variable would go under zero, it makes it zero instead.
Or to the event which substracts the variable, add to the event that it can not be substracted if it it would go under 0.




awesome idea! thanks !
B
2
Posts: 2
Reputation: 154

Post » Fri Feb 05, 2016 11:53 pm

Or use max()

On click -> Set variable to max(variable - 1, 0)


max() sets a lower limit, so it will always return the higher value of the two
B
83
S
22
G
15
Posts: 1,039
Reputation: 15,219


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 6 guests