How do I do cumulative points?

0 favourites
  • 11 posts
  • In my Star Catcher game I want to have cumulative points for consecutively catching the same type of star.

    for example for the one point stars, after you catch your first one the nest one is two points, the next three and so on and so forth.

    Thanks!

  • Have a variable that is incremented each time a player catches a star and have it add to your score each catch and reset to 0 when you miss one.

    You could also have an instance variable on the star itself which will increment by 1 each time a new one is spawned if the player is on a streak.

  • How would I do the second method? I just added the instance to my star and called it "streak".

  • Here is a simple example, left click to spawn a dot , arrow keys to move the player.

  • Thanks! I'll let you know if this helps.

  • No problem, you could also do a streak variable if you don't have a ground object.

  • I don't have a ground object, how would I do a streak variable?

  • Instead of having the score reset when it hits the ground, just create a streak variable( -1 for off 1 for on) and have the cumulative variable reset when the streak variable is off.

    I'm not sure how your game is set up, but when you miss a star just have it set the variable off or just have it reset the cumulative variable. It should be pretty easy to set up from the example I provided.

  • well my game is a "catch stuff as they fall" game and there are other stars too so I'm setting it up where I ad one to streak everytime you catch a 1 pt star but its reset to zero on other stars and space junk.

    Edit: IT WORKED!!!!!

    Now I just want to ask how can I give ten bonus points for every ten one point stars that are caught.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • well my game is a "catch stuff as they fall" game and there are other stars too so I'm setting it up where I ad one to streak everytime you catch a 1 pt star but its reset to zero on other stars and space junk.

    Edit: IT WORKED!!!!!

    Now I just want to ask how can I give ten bonus points for every ten one point stars that are caught.

    Basically the same way. Just create a variable that is increased by 1 every time a star with a value of 1 is caught, then when that variable = 10 give them 10 bonus points and reset it.

  • Worked too thanks!

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