In this lesson, we will create a movie scene and how to automatically move sprites to their spots in a scene.
Download the PDF copy of this lesson HERE.
Download the starting project HERE.
In this lesson, I will show you how to make sprites move to certain locations on the Stage. The Scratch Stage uses X-Y Coordinate System that looks as follow:
To demonstrate how to let sprites move by themselves, we will create a basic scene and three sprites with very simple scripts. A scene, like a movie scene, sets the tone of the story and provides a platform for the characters in the story.
Step 1: Create a Simple Scene
First, double click to select Stage. `
Click “Costumes” tab and there is a default background called “background1”. Click “Edit”.
Use Line Tool, Box Tool, and Circle Tool to create outline of two houses and a plate. Then use Fill Tool to fill in colors. When done, hit “OK”.
Step 2: Adding Simple Movement Scripts to Sprites
If you have not already, create three sprites: Mr. Meow (use the Scratch Cat), Donut Man, and Donut. Now let’s add scripts so that all sprites will show up in the right places when the animation starts (when the Start Flag is clicked).
|
Move three sprites as shown at the right. Donut Man to the green house, Mr. Meow to the red house, and Donut to the plate.
|
|
|
The x-axis and y-axis values are updated accordingly when moved. When a sprite is moved, the Motion blocks (“go to x=? y=?” block and “glide ? secs to x: ? y: ?” block) in the Tool Box are updated as well.
|
|
|
|
To build Mr. Meow’s scripts, select Mr. Meow from the Sprites Area, then click “Scripts” tab. From the Tool Box, click the “Control” button and drag “when Start Flag clicked” block to drop it in Scripts work area.
|
|
|
Then click “Motion” button in Tool Box Selection and drag “glide 1 secs to x:-183 y:-110” to the Stage. Then attach it under the “when Start Flag clicked” block.
|
|
|
Then click “Looks” button in Tool Box Selection, and drag “switch to costume1” to the Stage. Then attach it under the “glide 1 secs to x:-183 y:-110”.
|
|
Step3: Do the same for Donut Man and Donut
In the same way, create similar scripts for the Donut Man and the Donut.
Below is what result scripts should look like. Note that your x-axis and y-axis values will very likely be different than mine, and it’s OK.
|
|
|
|
Download the result project HERE.
Download the PDF copy of this lesson HERE.
TEST: Move sprites around in the Stage and clicking the Start to see all of the sprites gliding back to their positions.
- Comments
!joomlacomment 4.0 Copyright (C) 2009 Compojoom.com . All rights reserved."
| < Prev | Next > |
|---|



