1 / 7

How to Make a Sprite Jump in Scratch for Beginners

For structured Scratch learning, Juni Learning offers project-based Scratch Courses for students 8-11 to get started with coding. Our Scratch curriculum prepares students with full mastery of the Scratch environment, and prepares them to advance into coding with more advanced, text-based languages like Python. For more info visit https://junilearning.com/blog/coding-projects/how-to-make-scratch-sprite-jump/

alenasharma
Download Presentation

How to Make a Sprite Jump in Scratch for Beginners

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. How to Make a Sprite Jump in Scratch for Beginners (Kids 8+)

  2. How to Make a Simple Jump Mechanic • When our character jumps, he starts by moving up. However high he jumps, he must always fall back down the same amount. • This is pretty intuitive if you think about it — if you jump 3 feet into the air, you're always going to fall down 3 feet and land on the ground. This means that whenever we tell our sprite to move up, we must then tell it to move down by the same amount. • We’ll be using a new block to tell our character to move up/down vertically. This is the change y block. Whenever it runs, it tells our character to change its Y position by the specified amount. • If you recall, a sprite’s Y position determines its vertical position on the screen. A Y coordinate is usually paired with an X coordinate (that determines horizontal position) in order to describe exactly where a sprite is on our screen.

  3. The Simplest Possible Jump • This is the simplest possible way to make sprites jump on demand. It’s pretty short, with only 3 code blocks run when the spacebar key is pressed. Here’s a simple explanation of how the code works: • First, we use a change y block to tell the sprite to jump 100 pixels up into the air. • Once our sprite is mid-air, we tell it to wait 1 second in order to make sure we see it there. • Finally, we use another change y block to make our sprite fall back down to where it started. • Notice that since we tell our sprite to go up 100 pixels, we then have to tell it to go back down by the same amount. This is the key to making sure the sprite falls and always ends up back at the same spot.

  4. A Better Jump • This code is super easy to create, and is the jumping method that we teach in introductory Scratch courses. The way it works is very similar to the previous code, except that it uses repeat blocks to make the jump look smoother. This slows down the sprite and lets us see it move, making the jump look much more realistic. Because of this, we no longer need a wait block to slow down our code. • This new code looks much better, but you might notice that we're not able to move while jumping. Since this script uses a simple when Spacebar pressed event listener, we can’t use it at the same time as other event listeners like when Right arrow key pressed.

  5. This is pretty much the same code, but it uses an If spacebar pressed conditional instead of a when spacebar pressed event listener. Additionally, we also put the code inside of a forever loop to ensure that it always runs properly. • Since we no longer have key-dependent event listeners, our cat sprite can move and jump simultaneously!

  6. Keep Learning: Scratch Coding Classes for Kids • For structured Scratch learning, Juni Learning offers project-based Scratch Courses for students 8-11 to get started with coding. Our Scratch curriculum prepares students with full mastery of the Scratch environment, and prepares them to advance into coding with more advanced, text-based languages like Python. • Game Superstar (Scratch Level 1): introduces computer science fundamentals such and teaches students how to build and design their own Scratch games. • Game Master (Scratch Level 2): covers more complex concepts like nested loops, complex conditionals, cloning and more in preparation for learning more advanced coding languages. • Read more about our coding classes for kids, or speak with our Advisor Team to learn which course is best for your student’s coding journey by calling (650) 263-4306 or emailing advisors@learnwithjuni.com.

  7. Thank you!For more info visit https://junilearning.com/blog/coding-projects/how-to-make-scratch-sprite-jump/

More Related