checkpoint scoring

0 favourites
  • 8 posts
  • i created a few checkpoints in my game(a sprite box) using a local variable boolean"checked" and one called checkpointnumber as number with a different number to each box. so when my player collides with "checkpointnuber 1"set checkpointnumber to 1, "checked" set true and when i die spawn me at box 1 x,y. if i touch "checkpointnumber 2" spawn me when i die at box 2 x.y etc. how can i keep my score not to add up every time i die and restart from a checkpoint? what i mean is if i collect 100points reach checkpoint 1 gather another 100points but before i reach checkpoint 2 i die ,i want to restart with 100 points not 200. if i reach checkpoint 2 to store the points i have up to that moment etc.thank you!

  • use a global variable "pointsatcheckpoint" and set it when you reach the checkpoint. Then when you revive, set the score to pointsatcheckpoint.

  • thank you for your answer but i do not thing it is that simple :) maybe i am wrong. any more suggestions?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I would just use the suggestion mindfaQ gave, it should work.

  • how will it work? i have a global variable named score which holds my score(lol) if i create another one as mindfqk suggested lets talk about the event.

    if player is overlapping checkpoint set score = pointsatcheckpoint.

    on layout restart set pointsatcheckpoint = score ??

    every time i touch the checkpoint it will change the score if i have collected something more since my last overlapping. it need to store the number ONCEand only the first time i touch the checkpoint and override it only when i reach the second checkpoint.

    do i make sense?

  • Nope, on layout restart set score to pointsatcheckpoint.

    If you want to prevent abuse, make it this way:

    player overlapping checkpoint AND checkpointnumber < checkpointnumber : set pointsatcheckpoint to score

    add 1 to checkpointnumber

    this way it only happens the first time you hit it

  • Then, when the player die, you respawn him at the checkpoint and you copy pointsatcheckpoint into the score. And you should probably also make the checkpoint as activated alread.

  • mindfaQ thank you! it worked. <img src="smileys/smiley32.gif" border="0" align="middle" />

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