Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Aiming accuracy
- -KodyDragon
-
7 posts
Aiming accuracy
Hi guys im currently working on a fps aim trainer and im wondering if there is any possible way to get the players accuracy on shots?
Thanks!
Thanks!
- Spentine
-
1000+ posts
Aiming accuracy
We can just get the distance. Lower number, the better.
First, subtract the target position from both of the numbers.
x = mouse x
y = mouse y
t1 = target x
t2 = target y
v1 = variable
v2 = variable
v1 = x - t1
v2 = y - t2
Now, we take the distance from 0 using the pythagorean theorem.
sqrt((v1 * v1) + (v2 * v2))
Now, if the result of this equation is 0, then you can say that they got a perfect score.
First, subtract the target position from both of the numbers.
x = mouse x
y = mouse y
t1 = target x
t2 = target y
v1 = variable
v2 = variable
v1 = x - t1
v2 = y - t2
Now, we take the distance from 0 using the pythagorean theorem.
sqrt((v1 * v1) + (v2 * v2))
Now, if the result of this equation is 0, then you can say that they got a perfect score.
- Discussion Forums
- » Help with Scripts
-
» Aiming accuracy