Increase Global Number Every X Points

Get help using Construct 2

Post » Tue Sep 09, 2014 12:20 pm

I'm new to Construct 2 and I'm loving the software so far. Excellent work, Scirra!

My only question so far has been in regards to variables and setting values. I have a Global Number called "Points". Points will reset to 0 at the start of the layout, and will increase by 1 each time a specific action occurs. I would like to be able to increase another Global Number (speed) every time "points" reaches a multiple of 10. The idea is to increase difficulty as the player reaches 10, 20, 30+ points. I can manually enter the events by using the "set value" event when "points" = a multiple of 10, but I feel this isn't the smartest way to create this functionality. Although it may not matter as the game will become nearly impossible after a certain amount of points for the really good players.

Any suggestions would be greatly appreciated!
B
6
Posts: 16
Reputation: 284

Post » Tue Sep 09, 2014 12:48 pm

if (points % 10 = 0) add 1 to speed

translate to C2 code and should be right
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Tue Sep 09, 2014 1:11 pm

codah wrote:if (points % 10 = 0) add 1 to speed

translate to C2 code and should be right


Thanks for the suggestion! I was able to get the syntax correct so that speed increases by X amount when points reaches every 10th multiple, but the speed just continues to speed up until everything is a blur. I'll have to dig into a bit more to see how to increase the speed once, and not continually after the condition is met with a multiple of 10. Right off the bat, it appears that it keeps adding X amount to speed when the player reaches 10.

I appreciate the response. I'll keep working on it until I get it right, and I'll post my resolution here if I find it before someone else is able to reply with the Construct 2 solution.
B
6
Posts: 16
Reputation: 284

Post » Tue Sep 09, 2014 3:51 pm

First thing in my head is to have a global variable that mimics the points, but resets on each 10.

So, whenever your event adds to the points variable, have it add to another variable too. Then reset the second variable every multiple of 10 and add 1 to speed.
B
17
S
2
Posts: 46
Reputation: 1,105

Post » Tue Sep 09, 2014 3:58 pm

Grimbarian wrote:First thing in my head is to have a global variable that mimics the points, but resets on each 10.

So, whenever your event adds to the points variable, have it add to another variable too. Then reset the second variable every multiple of 10 and add 1 to speed.


I like this idea. Thanks. I'll give it a shot!
B
6
Posts: 16
Reputation: 284

Post » Tue May 24, 2016 7:32 pm

you should use the trigger once event :P
B
9
S
3
G
2
Posts: 24
Reputation: 1,825


Return to How do I....?

Who is online

Users browsing this forum: luckyrawatlucky and 5 guests