# Distance Score Infinite Jumper

Get help using Construct 2

### » Wed Feb 05, 2014 8:37 pm

The title says it all, I'm simply looking for a way to keep track of the distance traveled by my infinite jumper player, and display it in the game. Thank you in advance!
B
6
S
1
Posts: 89
Reputation: 619

### » Wed Feb 05, 2014 8:45 pm

Create a variable StartY and on start of layout set it to player.y
Create a variable Score and every tick set it to round(abs(player.y-StartY))LittleStain2014-02-05 22:19:50
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

### » Thu Feb 06, 2014 6:07 am

Thank you, took me a while but I finally figured it out.
B
6
S
1
Posts: 89
Reputation: 619

### » Thu Feb 06, 2014 11:43 pm

I have a new issue, now when the character is falling the distance decreases =/ how can I stop this from happening?
B
6
S
1
Posts: 89
Reputation: 619

### » Fri Feb 07, 2014 7:28 am

system compare two values : round(abs(player.y-StartY))>Score
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

### » Fri Feb 07, 2014 9:14 am

So for the first value I put        round(abs(Toby.y-StartY))

and for the comparison I put        > Greater than

then for the second value I put      Score

But after I click done, Construct tells me 'Score' needs an expression after it.

Any idea why it's saying that, if I did something wrong? Or if you know the expression that goes after Score. would be truly helpful.

Thank you

B
6
S
1
Posts: 89
Reputation: 619

### » Fri Feb 07, 2014 9:35 am

Score should be a global variable you created as I said in my first reaction.
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

### » Fri Feb 07, 2014 11:10 am

So I put the global variable StartY that you gave me in your first reaction after Score. and it didn't work it tells me Start is not an expression or instance variable in Score, then I put Score.Player.Y and it allows me to click done but the points are still decreasing as my player falls. Any help on elaborating?
B
6
S
1
Posts: 89
Reputation: 619

### » Fri Feb 07, 2014 11:18 am

I forgot the

on start of layout - system set value StartY : Player.y

but I hope you can understand this:

LittleStain2014-02-07 11:23:18
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

### » Fri Feb 07, 2014 11:20 am

I'll try, the image you attached to your post is not working for me though.
B
6
S
1
Posts: 89
Reputation: 619

Next