A. creating clones. Skills Training 5

Similar documents
In this project you ll learn how to create a game, in which you have to match up coloured dots with the correct part of the controller.

In this project you ll learn how to create a times table quiz, in which you have to get as many answers correct as you can in 30 seconds.

In this project we ll make our own version of the highly popular mobile game Flappy Bird. This project requires Scratch 2.0.

Create a game in which you have to guide a parrot through scrolling pipes to score points.

In this project, you will create a memory game where you have to memorise and repeat a sequence of random colours!

In this project you ll learn how to create a game in which you have to save the Earth from space monsters.

a. the costumes tab and costumes panel

Add in a new ghost sprite, and a suitable stage backdrop.

Create a Simple Game in Scratch

Clone Wars. Introduction. Scratch. In this project you ll learn how to create a game in which you have to save the Earth from space monsters.

AIM OF THE GAME GLACIER RACE. Glacier Race. Ben Gems: 20. Laura Gems: 13

In this project you ll learn how to create a platform game, in which you have to dodge the moving balls and reach the end of the level.

Introduction to Turtle Art

Create Your Own World

Creating Computer Games

Brain Game. Introduction. Scratch

Pong Game. Intermediate. LPo v1

Scratch for Beginners Workbook

Memory. Introduction. Scratch. In this project, you will create a memory game where you have to memorise and repeat a sequence of random colours!

Ghostbusters. Level. Introduction:

Flappy Parrot Level 2

COMPUTING CURRICULUM TOOLKIT

Fireworks. Level. Introduction: In this project, we ll create a fireworks display over a city. Activity Checklist Follow these INSTRUCTIONS one by one

Star Defender. Section 1

Programming with Scratch

The Beauty and Joy of Computing Lab Exercise 10: Shall we play a game? Objectives. Background (Pre-Lab Reading)

Let s start by making a pencil, that can be used to draw on the stage.

More Actions: A Galaxy of Possibilities

Step 1 : Earth and Mars Orbit the Sun

You are going to learn how to create a game in which a helicopter scores points by watering flowers in the city.

Whack-a-Witch. Level. Activity Checklist Follow these INSTRUCTIONS one by one. Test Your Project Click on the green flag to TEST your code

Introduction. Overview

Game Making Workshop on Scratch

Fish Chomp. Level. Activity Checklist Follow these INSTRUCTIONS one by one. Test Your Project Click on the green flag to TEST your code

04. Two Player Pong. 04.Two Player Pong

2D Platform. Table of Contents

Create Your Own World

Space Invadersesque 2D shooter

Creating a Maze Game in Tynker

Module 4 Build a Game

CISC 1600, Lab 2.2: More games in Scratch

Inspiring Creative Fun Ysbrydoledig Creadigol Hwyl. Kinect2Scratch Workbook

Lesson 2 Game Basics

CONCEPTS EXPLAINED CONCEPTS (IN ORDER)

Let s start by making a pencil that can be used to draw on the stage.

Copyright 2017 MakeUseOf. All Rights Reserved.

VACUUM MARAUDERS V1.0

Project 1: Game of Bricks

C# Tutorial Fighter Jet Shooting Game

Ada Lovelace Computing Level 3 Scratch Project ROAD RACER

Starting from LEARNER NOTES edited version. An Introduction to Computing Science by Jeremy Scott

Overview. The Game Idea

Scratch Programming Lesson 13. Mini Mario Game Part 4 Platforms

Scratch Primary Lesson 5

GAME:IT Junior Bouncing Ball

pla<orm-style game which you can later add your own levels, powers and characters to. Feel free to improve on my art

GAME PROGRAMMING & DESIGN LAB 1 Egg Catcher - a simple SCRATCH game

SAMPLE CHAPTER

Explore and Challenge:

Introducing Scratch Game development does not have to be difficult or expensive. The Lifelong Kindergarten Lab at Massachusetts Institute

Pong! The oldest commercially available game in history

Lesson 8 Tic-Tac-Toe (Noughts and Crosses)

In this project you ll learn how to code your own musical instruments!

5.0 Events and Actions

Tutorial: A scrolling shooter

1 Shooting Gallery Guide 2 SETUP. Unzip the ShootingGalleryFiles.zip file to a convenient location.

Lost in Space. Introduction. Scratch. You are going to learn how to program your own animation! Activity Checklist.

How to Create Website Banners

G54GAM Lab Session 1

How to Create Animated Vector Icons in Adobe Illustrator and Photoshop

ADDING A RAINBOW TO A PHOTOGRAPH

BE SURE TO COMPLETE HYPOTHESIS STATEMENTS FOR EACH STAGE. ( ) DO NOT USE THE TEST BUTTON IN THIS ACTIVITY UNTIL THE END!

Alright! I can feel my limbs again! Magic star web! The Dark Wizard? Who are you again? Nice work! You ve broken the Dark Wizard s spell!

Tutorial: Creating maze games

Game Design Curriculum Multimedia Fusion 2. Created by Rahul Khurana. Copyright, VisionTech Camps & Classes

Meteor Game for Multimedia Fusion 1.5

Where's the Treasure?

Once this function is called, it repeatedly does several things over and over, several times per second:

The Games Factory 2 Step-by-step Tutorial

GAME:IT Junior Bouncing Ball

Photoshop Backgrounds: Turn Any Photo Into A Background

Objectives: Create Sprites Create Sounds Create Objects Create Room Program simple game

Annex IV - Stencyl Tutorial

Game Maker Tutorial Creating Maze Games Written by Mark Overmars

Open the Tech Toys Scratch project. Your club leader will give you a copy of this project, or you can open it online at jumpto.cc/toys-go.

ChatBot. Introduction. Scratch. You are going to learn how to program your own talking robot! Activity Checklist. Test your Project.

CS 251 Intermediate Programming Space Invaders Project: Part 3 Complete Game

Exploring Photoshop Tutorial

Scrolling Shooter 1945

STEP-BY-STEP THINGS TO TRY FINISHED? START HERE NEW TO SCRATCH? CREATE YOUR FIRST SCRATCH PROJECT!

Survival Project. Unit 4 Concept Art. PO2: Understand industry tools and techniques for creating concept art

Kodu Game Programming

GAME:IT Bouncing Ball

Assessment. Self Assessment. Teacher Assessment. Date Learning Objective(s) Achievement or. NC Level: Game Control Student Booklet P a g e 1

1) How do I create a new program? 2) How do I add a new object? 3) How do I start my program?

Module. Introduction to Scratch

Scratch Coding And Geometry

A quick note: We hope that you will find something from the Tips and Tricks that will add a little pizazz to your yearbook pages!

UNDERSTANDING LAYER MASKS IN PHOTOSHOP

Reveal the mystery of the mask

Transcription:

A. creating clones 1. clone Bubbles In many projects you see multiple copies of a single sprite: bubbles in a fish tank, clouds of smoke, rockets, bullets, flocks of birds or of sheep, players on a soccer team, etc. In Scratch 2 you can create a single sprite and then generate many clones of the sprite. You might have a very busy stage but when you stop the script, all you see is your single sprite. www.scratch.mit.edu/projects/19857330 5_01 clone_bubbles The image made by the stamp block cannot move or be moved. It doesn't have a unique identity or name and cannot respond to a message or to user interaction the way a sprite can. The stamp block instructs the sprite to create a picture of itself at the current location of the sprite. A clone is a copy of a parent sprite. It inherits the parent's scripts, costumes, sounds, and properties, and it can be moved, modified and made to behave in a different manner from the original. However it is not a sprite and can't respond to user interaction as it doesn't have a unique identity or name. All clones share the same scripts. The three clone blocks are used to create and programme clones of a sprite. fish sprite fish script 1 of 2 To do: Create an underwater animation. One fish sprite creates a clone of itself so that two fish are seen swimming about. The fish sprite also creates a clone of another sprite (a bubble). The clones just keep bubbling up from the mouth of the fish. The blocks are in the Control palette. the only hat block not in the Events palette. I am the Fish - the little green guy is only my clone the clone of this fish forever loop creates a clone of the bubble in each pass of the loop. animates this sprite (the fish) moves this sprite... or of another sprite It s important to delete the clone inside a forever loop otherwise too many clones will be generated and the programme will crash. Bubble scripts changes the y-position of this sprite fish script 2 of 2 The clone does not have a script Hide parent bubble so that it s not visible on the stage. Use the show block to make the clones visible. changes clone s direction, position, colour and size defines the animation and movement characteristics of my clone Question: When the programme is stopped the small fish and the bubbles disappear. Why is this? 80 When each bubble clone starts it goes to the stage position of the Fish. To help make this happen, in the Paint Editor set costume centre of the fish over its mouth.

2. clone Bullets www.scratch.mit.edu/projects/22498561 (a) scripts on alien sprite 5_02 shootaliens 3 costumes on each alien alienship1 alienship1a shellblast (1) To do: This Spacewars game works well but it is incomplete. There is only one alien ship. There is no Score script and it needs a Timing script also. Can you make it more exciting and perhaps add sound and other features? NOTES: (2) (3) (1) The repeat until loop makes the animated Alien ship move down the stage until it either touches the bottom edge or else it collides with a laser bullet. (2) If touching the bottom of the stage, it makes the alien ship disappear for up to 2 seconds, after which it appears again at the top of the stage. (3) if touching the laser bullet it sends out the broadcast 'hit', switches to shellblast costume, fades away due to the ghost effect in the repeat 10 loop and it returns to the top of the stage to fight again. (4) The laser bullet sprite responds to the space key which creates a clone of itself each time it's pressed. The bullet takes up position under the barrel of the gun and points in the same direction as the barrel. The repeat until (touching edge) loop makes it move at 20 steps until it is deleted at the edge of the stage. The delete this clone block removes it if it hits the alien ship. (5) Player controls the gun barrel with keyboard. Initially it points upwards and the go to front block ensures that the barrel is to the front with the bullet hidden beneath it. (c) script on gun sprite (b) Laser sprite scripts (yellow) (4) (d) scripts on rotating barrell sprite (5) 81

B. new blocks: how to Define a procedure Introduced page 48 This procedure clears previous drawings and it initialises the pen state and settings. It also set the initial direction and position of the sprite. 3. draw Flowers www.scratch.mit.edu/projects/22531677 5_03 flowerdraw x2 Draws flower Draw the full shape 5 times with a 72º turn in each pass of the loop. (5 x 72º = 360º) This procedure draws the curve of an arc which is a quarter of the circumference of a circle. To get this precise curve the repeat value x degrees must equal 90º. (repeat 15x6º = 90º). The value of the move steps only affects the size of the shape. The point in direction combination initialises the direction of the pen before drawing the second curve in the shape (shown with the dashed line). To do: Draw a 5-petal flower using procedures to initialise the pen and draw the flower components. To try: Define a procedure called flower and script a design that draws many flowers. 4. draw Trees www.scratch.mit.edu/projects/22652317 5_04 drawtrees To do: Draw a tree using the technique for drawing a circle from centre on page 31. To try: Adapt this to draw flowers using the same technique. main script Note: The tree has 18 radial branches. 18 x 20º = 360 The line thickness (pen size) makes a 20º turn adequate. Experiment with pen size and amount of turning. the random numbers create the tree effect, by varying the length of each branch. 82

5. Jumps and Cartwheels www.scratch.mit.edu/projects/23016400 5_05 jumpcartwheel In the More Blocks palette click Make a Block, give it a name and click OK. You have a new block in the palette and a special definition block in the Scripts area. The script under the definition block defines what the new block does. This project has two new blocks, one will make the ballerina sprite do a cartwheel, the other will make her do a triple jump. There is an option to add various types of inputs (or parameters). The Jump block definition has two number parameters, the height (number of steps ) and the wait (number of seconds). Finally, to run the procedures, create a main script which contains the new blocks. To do: Make the Ballerina do gymnastics. See page 25 for previous use of ballerina sprite graphic. (c) cartwheel definition simple definition block (a) the main script my cartwheel new block with parameters (b) jump definition my triple jump NOTE 1: The ballerina sprite comes with 4 costumes but you can edit it to add your own extra costumes. down1 NOTE 2: A block definition cannot be deleted until all instances of its defined block are first deleted from the scripts area. NOTE 3: Notice how parameter blocks e.g. wait and height can be added to operators. 83

6. fireworks Display www.scratch.mit.edu/projects/22538818 5_06 Fireworks (a) Only 1 sprite is necessary but you can make two duplicates as pictured. sprite 1 exploding Each sprite has 3 costumes. costume 2 flash 1 costume 1 rocket sprite 2 exploding sprite 3 taking off as rocket To do: Create a simulation of a fireworks display. costume 3 flash 2 Create the sprite and its costumes in the Paint Editor of Scratch 2.0. Alternatively, you could use external software such as DrawPlus - see page 41 for hints and ideas. (b) the main script hides sprite at start NOTE: Randomise other sprites to have different wait intervals e.g. 1 to 4 secs, 2 to 5 secs etc. clicking the stage starts the firework show it s a continuous show hides firework after completing previous loop returns sprite to normal size after previous loop clears graphic effects from previous loop randomises number of seconds before ignition (See note above) sets y at bottom of stage randomises x script (c) script (d) runs new ignite block (see definition block below) runs new explode block (see definition block on opposite page) changes backdrop to starry night sky (c) ignition block definition makes and defines ignite block firework starts as a rocket sets random colour of rocket and explosion makes the rocket visible loop makes rocket rise into sky reaching random heights of between 10x10, 11x10, 12x10 etc to 25x10 pixels (100 to 250 px) 84

(d) explode block definition makes and defines explode block switches rocket costume to flash1 to simulate explosion step 1 grows between 50% and 150% sound of firework (imported from free sound effects web site) switches to explosion step 2 (extra flashes) makes explosion expand brightens sky gives increasing sparkle effect to explosion makes explosion gradually disappear (vanishing at 100%) Click the stage to start the animation 7. clone Swarm www.scratch.mit.edu/projects/22542618 5_07 cloneswarm (a) Create two variables score and I'm a Clone. The point in direction (pick random 1 to 360) combination is an alternative to x, y coordinates to use the whole stage. (b) The mod operator was used already on pages 76,77. Here it's used to create a new clone at every 10th score. (c).. If I'm not a Clone create a clone of myself (d) Change Boolean value to true. Change colour so that the parent sprite stands out from the crowd. To do: Script a single sprite ( a larget dot) to create a clone of itself each time the score increments to a multiple of 10. All the scripts are on the one sprite. A Boolean value can only be true or false. In (d) I'm a (a) Clone is set to true because when I start as a clone the variable's value is true... In (a) I'm a Clone is not a clone yet, so it's false. (b) (c) (d) This animation illustrates how clones don't have individuality in the way a sprite does. The clones all take the same instruction and all behave in the same way. They can act differently from the parent but all will act diffently together. When the programme is stopped all you see is the parent sprite.... See a similar use of 0 and 1 as Boolean values on pages 76, 77. 85

8. hop Rabbit www.scratch.mit.edu/projects/22546814 5_08 hoprabbit Hop Rabbit Hop A rabbit sits on the near side of an 8-lane motorway. Cars are approaching from 4 lanes on the right and from 4 lanes on the left. The rabbit wants to cross the motorway to collect carrots from the field opposite. In the game, the player must make the rabbit hop across the motorway without getting run over by a car. The rabbit must collect a carrot and bring it back to the near side. Every hop is worth a score of 1 and every carrot he collects gives him a 10 points bonus. The rabbit returns to his starting position when he is run over by a car. If he is in possession of a carrot, when he is run over, the carrot is returned to its starting position also. The game ends after 2 minutes is reached or if the rabbit loses all his five lives. To do: Create a game in which a rabbit has to cross a busy motorway to collect carrots. 1. Background: Draw a background consisting of 10 rectangles 480 x 36 pixels. Colour the rectangles as shown, the top rectangle should resemble a field for the carrots and the bottom rectangle represents a green grassy verge. 2. Variables: for Number, Position offset, Score, Lives, Timer. Variable scripts are not shown here. Go online and click See inside. Create the variable scripts on the stage. Click the Stage icon on the left of the sprite thumbnails. 3. the Cars: Car 1 of 4 and its clone Draw the top-view of a car in the Scratch Paint Editor or in an external drawing environment. Although it appears that there are eight cars, there are only four cars and each has one clone. See (c). a. When you set color to 0, you set it to its default colour. In this case, red. b. Car 1 of 4 starts off the stage in the top lane moving right to left. See (g) c. Each car appears as two cars on the stage, the original car and a clone of itself. d. This is a custom made block which has a definition block below. e. The red car, car 1 creates a clone of itself (block c). The clone appears as the green car in the lane just below the red car. Set color to 80 to change the clone into a green car. f. The cloned car starts in on the stage and in the lane below its origin sprite. same as (d). Custom block definition: g. Each time the custom block Move car is used, the sprite follows this script. The block can be used in other sprites, but it must be redefined. This allows for variations. See i. h. Always start with show, when hide block is used in a script. i. When the Move car block is redefined for Cars 2, 3 and 4 you can set a different speed for each. j. The If loop runs the wrapping and pausing feature that make the re-appearance of the cars less predictable. The wait algorithm produces values 0, 0.2, 0.4... 1.6, 1.8. 2.0 secs To do: Create and script the cars 2, 3 and 4 and their vlones 86

4. Carrots This is carrot script 2 of 2: Collision script Logic: The Carrot go Back message is received by the carrot when the rabbit collides with a car. If the Y position of this carrot is the same as the rabbit s Y position and it s not at the green grassy verge it means the rabbit is in possession of the carrot. Then it should go back to start resetting number of carrots to 5. 5. The Rabbit carrot script 1 of 2 3 costumes: 5 scripts Draw a rabbit sprite or import sprite from internet images or from this project. Create 3 costumes, rabbit1, rabbit2 and rabbit3. At start up, go to front ensures the rabbit is not hidden behind a car or carrot. Costumes 2 and 3 are used when the rabbit is run over by a car. When that happens, the rabbit broadcasts a message to the carrot sprites and returns to its starting position. x5 Programme the Rabbit to carry a carrot Logic: If the number of carrots = 5 and the rabbit touches this carrot then they should both have same x, y until they reach the green grassy verge. Then the number of carrots is reduced by 1. Bonus points are scored. The carrot x,y is set to green verge. Loop ensures the rabbit doesn t go above top of stage. Loop ensures the rabbit doesn t go below bottom of stage. Resets rabbit to start position. The broadcast instructs the carrot to go back to its start position when the rabbit is run over while in possession of a carrot. (See carrot script 2) Scripts to move the rabbit using arrow keys on keyboard x2 To do: Make changes for down arrow with score for each hop. x2 Make changes for right arrow. No score for sideways hops. 87

C. create a list 9. Ten Questions www.scratch.mit.edu/projects/22663222 (a) 5_09 tenquestions (c) (b) (d) (e) (f) (g) (h) (j) If you like the book If you want to add ten questions to questions click To do: Create two list (i) 10 questions (ii) 10 answers and would like the + ten times and you will get ten empty input boxes. As you fill in the items, a scroll bar appears on the right of the monitor. to continue beyond Variables and Lists are in the same palette, because lists are like variables. A variable can hold only one value at a time. A list can hold several values, all at the same time. When you click the Make a List button the next thing you do is to give your list a name and click OK. Make a List this point OR: Alternatively, you can add things to the list with the add to block. Type into the small input window and click the block to add each item. please buy the book OR: There is a third, and very easy method to add or contact atcreate your list in Word or Notepad itemsme to a list. New List List name: You must have a sprite, but when creating a list, it may suit better to hide it. questions For all sprites OK For this sprite only Click BUY A BOOK in main menu Resize the list monitor by dragging from bottom right Immediately all the List blocks (a) to (j) appear and a list monitor pops up on the stage. You can type directly into the list monitor. Let s suppose you have given the list the name questions. You have not added any items to questions yet so the list is empty, with length 0. To add items to questions, click the plus + button in the bottom left of the list monitor. 88 the list directly, using the list monitor. 1. Now, create two lists: One is a list of words that will form the questions. The other list of words will form the answers. It is important that both lists be the exact same length and that the index number of each should correspond. Cancel fox empty list monitor and save as a plain.txt file. When creating your list, right-click on the list monitor and import the txt file seamus@weandus.ie. list you have already prepared. Here, we will fill in fox hare cub leveret hen cow sheep chicken calf lamb pig horse goose piglet foal gosling cat kitten dog pup A list of adult anmals and another list of their young. The number in front of each item is known as its index number. Each list has a length of 10. Both lists must be the same length.