0 Favourites

Increase Global Number Every X Points

  • 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!

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

    translate to C2 code and should be right

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • 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!

  • you should use the trigger once event

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)