Spawn clones

Keyboard Shortcuts

Clones are copies of objects. This movie using the cloning built into Scratch to spawn endless rocks from the sky for the player to dodge. In this movie, see how to use the cloning tools to spawn the rocks. Also see how to set an object as your cloning template, and how to set its position at the top of the screen using a script. Finally, see how to make objects spawn and fall down at a given rate of speed.

- [Voiceover] Our next step is to make the rocks move down.…And we're going to use the same scripts to make…the apples move down later on.…Let's head over to the rocks,…and I'm going to put it at the top, at about the center.…Notice the X and Y values here.…The Y values go up as an object goes up,…and then down as the object goes down,…and X values go low to the left, and high on the right.…In the center, though, both are at zero.…And that's important to understand.…So we want an X of zero to start out this rock every time,…and we want it to be above the screen.…

Now when I put my cursor all the way at the top,…I get Y of 178.…The top is at Y of 180.…So I need to put it at or above 180…to get it nice and high up there so it's not showing…on the screen all the time.…In addition to that, I don't want…this main rock to show ever.…I want this rock to be basically…a clone factory, as we've looked at earlier in this course.…So let's start doing that.…So with the rock selected, I'm going to head over to events,…and drag out when green flag clicked.…

Resume Transcript Auto-Scroll

Author

Released

4/26/2016

Scratch is an up-and-coming introductory programming language. Developed by students at MIT, Scratch allows users to create web animations, games, and interactive stories, all without a single line of code. Originally intended for kids ages 8–16, Scratch's web-based platform is ideal for educators who want to incorporate programming in the classroom, and adult students who want to learn a visual language before progressing to code. Todd Perkins, author of Programming for Non-Programmers, shows how to use Scratch to create simple web projects and teach yourself basic programming concepts along the way.

He starts with demonstrating how to create your first project and gather the artwork (aka sprites) and other assets you'll need to build it. Todd then reviews the prebuilt scripts, the bits of code that control the logic of your Scratch projects, and explains how to use the different script types for different functions, such as animating sprites, responding to events such as button clicks, and comparing values. In chapter 3, he covers costumes, and in chapter 4, he shows how to load and play sounds. Finally, he shows how to put it all together into a complete web game, which you can then share with the Scratch community.

Topics include:

What is Scratch?

Creating your first project

Choosing a backdrop for your application

Creating sprites (reusable graphics) in Scratch

Working with scripts: animating objects, responding to events, and checking logic