What is velocity and how can I use it?

help_me_please
please

#1

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


#2

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


#3

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”


#4

Hi @FRENCH_WAVE123

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.


#5

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


#6

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


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


#7

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.

Instead, you’d want to use

 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.


#8

Or what I said…


#9

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


#10

You’ve got some great explanations above :slight_smile:
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)


#11

@POMTL can you help?


#12

Velocaty is speed in a certain direction