# game: race

I want to set points on the screen for each racer.
But it didn’t work, what’s my mistake?

``````-- race2

function setup()
--The values of the two racers
r1 = 20
r2 = 20
--The two speeds for the racers, uses math.random to pick a random value
rs1 = math.random(6)
rs2 = math.random(6)
puntenr1=0
puntenr2=0
end

function draw()
--Increasing their y values by their speed
r1 = r1 + rs1
r2 = r2 + rs2

background(40, 40, 50)

sprite("Planet Cute:Character Boy", 600, r1)
sprite("Planet Cute:Character Cat Girl", 300, r2)

text(puntenr1, 600, 700)
text(puntenr2, 500, 700)

--If either of the racers are above the screen, then reset their positions and speeds
if r1 > HEIGHT or r2>HEIGHT then
r1 = 20
r2 = 20
rs1 = math.random(6)
rs2 = math.random(6)
end

if r1 > HEIGHT then
puntenr1=puntenr1+1
end

if r2 > HEIGHT then
puntenr2=puntenr2+1
end

end
``````

Hi, please use the three tidles (these things ~ ) before and after your code, that’ll make it easier to read.

@AnnSophie Move the last 2 if statements up so they’re after the 2 text statements. You’re setting r1 and r2 to 20 before comparing them to HEIGHT.