checkpoint scoring

Get help using Construct 2

Post » Mon Oct 21, 2013 1:05 pm

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!
B
15
S
6
G
4
Posts: 277
Reputation: 3,948

Post » Mon Oct 21, 2013 1:32 pm

use a global variable "pointsatcheckpoint" and set it when you reach the checkpoint. Then when you revive, set the score to pointsatcheckpoint.
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 788
Reputation: 3,788

Post » Mon Oct 21, 2013 1:52 pm

thank you for your answer but i do not thing it is that simple :) maybe i am wrong. any more suggestions?
B
15
S
6
G
4
Posts: 277
Reputation: 3,948

Post » Mon Oct 21, 2013 1:55 pm

I would just use the suggestion @mindfaQ gave, it should work.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Oct 21, 2013 2:10 pm

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?
B
15
S
6
G
4
Posts: 277
Reputation: 3,948

Post » Mon Oct 21, 2013 2:18 pm

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 itmindfaQ2013-10-21 14:18:59
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 788
Reputation: 3,788

Post » Mon Oct 21, 2013 2:19 pm

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.narFsnw2013-10-21 14:20:07
B
20
S
5
Posts: 80
Reputation: 1,408

Post » Tue Oct 22, 2013 12:06 am

@mindfaQ thank you! it worked.
B
15
S
6
G
4
Posts: 277
Reputation: 3,948


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider] and 42 guests