For example, in a maze game, how can you calculate the distance that the sprite travels on the canvas from the start point to the end point? I see blocks for the sprite speed, but not distance.
Distance = speed * time
So if you know the speed and you measure the time, then you can calculate the distance.
You can measure time by comparing the starting and ending values of the “seconds since 1970” block in the Device drawer.
Thanks @tatiang , a simple solution. It’s not that important for my app but I’m wondering what the units of measure are for the gyroscope angular velocity? Pixels per second perhaps?
For anyone else trying to do the same thing, I’ve copied my blocks here to measure the distance moved in 30 seconds.
1 Like
Awesome, thanks for sharing your blocks!
I wouldn’t know the answer to your question but perhaps Thunkable Staff know.