# What is velocity and how can I use it?

I really want to use velocity in my games…but I don’t exactly know how…

7 Likes

Hey guys I’m so sorry if if i tagged you​:star_struck:@OMTL

8 Likes

Hello again!
(You just tagged us all)

I’ll try to find some velocity code

and maybe also some “when ipad is tapped/not tappd”

3 Likes

Velocity is just another word for speed.

(Well, technically velocity is a vector which means it’s a speed and a direction. But most people just use it as a substitute, “fancy” word for speed)

On Hopscotch, objects have a Speed trait which determines how fast the object moves if you use a motion block like Move Forward. But the object only moves in the direction it’s “facing”. To get motion in other directions we use a variable, which could be named velocity, along with a Set Position block. One use is simulating gravity.

Note: the velocity variables & bounce height are in blank projects because they’re used by the Bounce custom rule

There’s many different ways to use/code the concept of velocity.

Try adding a new object and adding the Bounce rule. Check out the cool effect when you play it, then check out the code.

8 Likes

Velocity also includes the direction you are going in, not just speed

2 Likes

velocity is, basically, direction and speed. it’s a pretty cool concept.

here’s a simple code to make a character fall down.

2 Likes

Hi @claw33

Don’t forget that the Change Y by ____ block changes the distance of the input. But the speed at which that distance is changed is dependent on the Speed trait (default of 400, which means 10 pixels per frame)

So your variable may be named Vertical Velocity, but in the example you gave it means distance.

`````` Set Position x [(self) X Position]) y [(self) Y Position - Vertical_Velocity]
``````

The difference is that Set Position jumps directly to the new position, independent of the object’s Speed trait. So by increasing the value of the Vertical Velocity variable it progressively moves faster.

3 Likes

Or what I said…

1 Like

Velocity is like gravity force, and how other forces are beaten by gravity. Like a thrust force

2 Likes

You’ve got some great explanations above
If you want the word defined, use WolframAlpha (www.wolframalpha.com), a really smart search engine that probably will show you a simple definition if you search “What is velocity?” (it worked for me)

@POMTL can you help?

5 Likes

Velocaty is speed in a certain direction

2 Likes