Scratch for Intelligence

Scratch for interactivity l.jpg
1 / 47
914 days ago, 203 views
PowerPoint PPT Presentation
We will make an amusement where the player controls an infant utilizing the bolt keys to get a falling ball. In the event that the child misses the ball the diversion is over. ...

Presentation Transcript

Slide 1

Scratch for Interactivity

Slide 2

Activity – An amusement We will make a diversion where the player controls an infant utilizing the bolt keys to get a falling ball. On the off chance that the child misses the ball the diversion is over.

Slide 3

Activity #2 - Goals Learn about present occasion taking care of present conditionals present factors more with circles more with parallel execution more with message passing

Slide 4

Delete the Cat Click on the scissors and your cursor swings to scissors and after that tap on the feline to erase it Or right tap on the feline and pick erase

Slide 5

Add the Baby Click on the catch with the photo of envelope with a star in it on the off chance that you float over it, it says "Choose new sprite from file"

Slide 6

Select the People Folder

Slide 7

Scroll to the Baby Click on the child and afterward OK

Slide 8

Resize Your Sprite! You can make your sprite bigger or littler by utilizing the "develop sprite" or "psychologist sprite" symbols. You tap on one of these symbols, then tap on your sprite until it is the size you'd like. contract develop

Slide 9

Move the Sprite Select (tap on the bolt and after that on the sprite) and snap and drag the sprite to the base of the window

Slide 10

Add a Background Click on the Stage In the base right territory Click on the Backgrounds tab In the middle Click on the import catch Pick a foundation Like bedroom1 in inside

Slide 11

Event Handling We need to control the child utilizing the bolt keys When we tap the left bolt the infant ought to move left When we tap the right bolt the infant ought to move right This is a type of occasion taking care of Responding to client activities like mouse snaps and key presses

Slide 12

Respond to Arrow Keys Click on Control and afterward drag out " when space scratch squeezed "

Slide 13

Respond to Right Arrow Click on down bolt alongside space and select right bolt

Slide 14

Respond to Right Arrow Click on Motion and drag out " move 10 stages "

Slide 15

Change the move sum Click on the 10 it will highlight in blue Type 5 and press enter

Slide 16

Respond to Arrow Keys Drag out " when space scratch squeezed " Change "space" to "left arrow" Drag out " move 10 stages " Change it to - 5 (to move left) Click on the stage and experiment with the left and right bolt scratches Does the sprite leave the window?

Slide 17

Paint a Ball Click on the paint brush and star It will state "Paint new sprite" in the event that you float over it

Slide 18

Draw the Ball Click the circle device and afterward utilize the eyedropper to pick a shading and after that snap in the attracting territory and drag to make the ball Circle instrument and eyedropper Drawing region Click alright when done

Slide 19

Size the ball as coveted and move it to the top Click and drag the ball to the highest point of the window

Slide 20

Make the Ball Fall When the green banner is clicked we need the ball to dependably begin at the top and tumble down Click on Control Drag out " When green banner clicked "

Slide 21

Start the Ball Click on Motion Drag out " go to x # y # " this will dependably begin the ball at its present position (Scratch doesn't consequently return it for you).

Slide 22

Sequential Execution One piece is executed after the other all together through and through When the green banner is tapped the ball will go to the predefined x and y area

Slide 23

Loops We need the ball to keep on moving down unless the infant gets it How would we get this going? We could utilize bunches of pieces in a steady progression But, that would be moderate and dull We require an approach to rehash a square or set of hinders This is known as a circle or emphasis

Slide 24

Make the ball fall Click on Control drag out " always " Click on Motion drag out "change y by 10" Change it to - 1 Try it out!

Slide 25

Catch the ball! On the off chance that the ball touches the infant then it is gotten Let's track what number of balls we have gotten with a score We will augment the score every time we get a ball

Slide 26

Variables If we will monitor the score We need something to hold the present score And we need to have the capacity to change the score We need the esteem to change or fluctuate This is known as a variable

Slide 27

Track the score When we begin the diversion set the score to 0 Click on Variables Click on Make a Variable Name it score

Slide 28

Set score to 0 In the ball script Drag the "eternity" down Drag out "set score to 0" Drag the "eternity" go down Notice the score appearing on the window

Slide 29

Conditionals We need to build the score if the child got the ball So this activity will just happen just if some condition is genuine This is known as a contingent or an "if"

Slide 30

Conditional Statements This code implies that if the client presses the Space key on the console, the sprite will move 10 stages. See the "point edged" square. These squares are utilized to answer Boolean (genuine/false) questions.

Slide 31

Conditional Statements Notice the "point edged" square. These squares are utilized to answer Boolean (genuine/false) questions. Restrictive squares are acquired from either the Operators or the Sensing menu.

Slide 32

Sensing The detecting menu contains various squares which distinguish whether certain circumstances are valid (or false). In our present program we are keen on the "touching" piece.

Slide 33

Did we get the ball? From Control drag out an "if" Check if the ball is touching the infant Get this in Sensing If this is genuine augmentation the score From Variables

Slide 34

Reset the Ball If we got the ball Increment the score And move the ball to some irregular spot at the highest point of the window So we don't continue expanding the score

Slide 35

Reset the Ball Click on Number drag out "pick arbitrary 1 to 10" drop on the x esteem after "go to x:" change the 1 to - 235 and change 10 to 235 change the y esteem to coordinate the y in the primary "go to x # y #"

Slide 36

Adding Losing If the infant doesn't get the ball it just stalls out at the base of the screen Let's tell the player that he or she lost

Slide 37

Add a content sprite Click on the Paint new sprite catch Click on the T for content Pick the shading Modify the text dimension Move the square to where you need the content Type You Lost!

Slide 38

Hide the sprite We would prefer not to tell the player that she lost when the amusement begins So shroud the message when the diversion begins Click on Control drag out " when green banner clicked " Click on Looks drag out " cover up "

Slide 39

Check if Lost If the y position gets close to the base (close - 180) Drag out an if from Control Drag out a clear < clear From Numbers Add a y position From Motion Type in - 175

Slide 40

Broadcast a message Sprites impart by passing messages One sprite communicates the message Other sprites can listen for it and respond to it when they get it Click on Control drag out " communicate clear " tap on the drop down bolt next to new – name it lost Add " stop script " to stop the eternity circle

Slide 41

Receive Lost Click on the content sprite Click on Control drag out "when I get blank" tap on the down bolt and select lost Click on Looks drag out "show" Click on Control drag out "stop all" to stop all scripts

Slide 42

Parallel Execution We have a few things happening in the meantime when the green banner is clicked This is called parallel execution More than one thing happening at once

Slide 43

Create Instructions Click on the Show Project Notes symbol in the upper right corner Add the directions Press OK

Slide 44

Test your game Click the green banner If you need, conform the speed of the ball Increase the sum it changes in y Modify the sprites utilizing the "Outfit" tab Save your amusement with the "Spare" catch

Slide 45

Other Ideas Add a sound when you lose Add the capacity to win When you achieve a specific score Track the measure of time it takes also Speed up the ball after some time Add more sprites to catch Add a sprite to stay away from (like a major sibling) executioner sprite

Slide 46

Concept Summary The Variables menu can hold values and can change esteem The Sensing menu Can be utilized to check whether certain conditions exist Forever circles rehash every one of the charges within them each one in turn until the script is halted or all scripts are ceased Conditionals – uncertainties just execute the body of the if when the condition is genuine Sometimes utilized with detecting squares

Slide 47

Concept Summary Sprites can pass messages and get them Sprites can respond to occasions like tapping the green banner and squeezing the left or right bolt keys Sprites can have a few scripts, ensembles, and sounds Things can happen in a steady progression – consecutive execution or in the meantime – parallel execution