2 boxes

I have two boxes one is stationary and the other box you can move left and right. How could i make it so when i move the box away from the other box a score gets bigger and when you move them closer the score gets smaller?

@Andeewsimpson you could use the coordinates as score…


box 1:  vec2(xbox1, ybox1)
box 2: vec2(xbox2,ybox2)

score = math.abs(xbox2 - xbox1)

Is there a max distance the box can move?

thanks!!! How could I customize it more. For example if I don’t want it to change numbers so fast, so like every inch it would go down only 1 number? @stevon8er

Just divide it by some value.

score = math.abs(xbox2 - xbox1)/100

EDIT: if you don’t want fractions in score , use math.floor().