Get Kids into Coding with Scratch

# Velocity Practice

## Steve Kinney

Temporal

### Check out a free preview of the full Get Kids into Coding with Scratch course

The "Velocity Practice" Lesson is part of the full, Get Kids into Coding with Scratch course featured in this preview video. Here's what you'd learn in this lesson:

Steve instructs students to utilize the concepts covered in the previous lesson to implement velocity for the sprite's up and down movements. A possible solution is also covered in this segment.

Preview
Close

### Transcript from the "Velocity Practice" Lesson

[00:00:00]
>> For this character, can you take a second and do the same basic mechanics, but for y speed, so that we can move up and down. And it should slow down at around 80%. And I'll take a look at it with you, Wes, if you need help.
>> What?

[00:00:13]
>> You want me to take a look at it with you?
>> No.
>> Okay, so I'll keep that there, see if you can get y going, and then you can kind of slide around in both. And it should feel a lot better than even our taco chase game felt at the beginning of the day.

[00:00:29]
Cool, so yeah, oddly satisfying, makes you feel good. Really, to do it for the y, we do need to duplicate a bunch of this, cuz we can't store two values in the same thing. And what we're doing with x is not the same as y. So we kinda just need to do some more of the same, in this case.

[00:00:48]
So we've got, again, for this sprite only, we got our y speed, which I've misspelled for the second time, Go me. And so we'll set that y speed over to 0 in the beginning as well, and, I'm gonna do some duplication action here. I duplicated a little bit too much there, but we'll get rid of some stuff.

[00:01:16]
I'll have the y speed go -10, and then we just gotta make sure we adjust everything accordingly. Change this one to y speed, y speed, and y speed, okay, that should do the trick, we'll find out. No, if up arrow was pressed. Let's see, left and right are the x speed, I'm changing.

[00:01:51]
Obviously, change x by y speed is not gonna work [LAUGH]. I mean, the work does not what I wanted.
>> You should make the ball look like it's spinning.
>> We don't want me opening the sprite editor and playing with this. I will lose seven hours of my life making the most unhinged sprites you've ever seen in your life.

[00:02:07]
>> You can use this, but rotate it, but-
>> The problem is I know what I will do, [LAUGH] I will be a bad person [LAUGH]. Change y by the y speed, that's by the 10. [LAUGH] I probably should stop my program from running. That's why we don't make changes in production.

[00:02:31]
And I can go diagonal as well, it's got that nice. Really, I'm not gonna say that I was in a meeting and I had this going and I was doing this as a fidget toy during a meeting at any point in the last. This is kinda like that driving mechanism that we had in the very beginning where we just had him turn, right?

[00:02:52]
That was obviously he was always moving and had to be the turn angle. Well, at this point, we could theoretically, definitely try to avoid, so I could bring this mechanic back to Taco Chase.
>> Another thing, you could use the pen tool to make a kind of trail behind it that disappears.

[00:03:12]
>> We're going there, we're gonna.
>> That'd be cool.
>> We'll use the pen tool a little bit, the pen tool will be coming out.
>> Yay.
>> Yay! [INAUDIBLE]
>> Oddly satisfying, definitely not something I did during a meeting at all, I sat there and fidgeted with.

[00:03:31]
Definitely not buying time right now as I sit here and also fidget with it cuz I can't put it down.

### Learn Straight from the Experts Who Shape the Modern Web

• In-depth Courses