Difference between revisions of "Game On/Scratch Blocks"

From Wiki - Scioly.org
Jump to: navigation, search
(Move)
m (adding navbox)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This is a list of blocks that are useful for Game On.
+
This is a list of blocks that are useful for [[Game On]].
  
=Motion=
+
==Motion==
==Move==
+
===Move===
 
The block "move ____ steps" causes the sprite to move in the preset direction, a certain number of "steps".  A typical noticeable motion is 5-10 steps.
 
The block "move ____ steps" causes the sprite to move in the preset direction, a certain number of "steps".  A typical noticeable motion is 5-10 steps.
  
==Turn==
+
===Turn===
 
The "turn ___ degrees left/right" blocks cause the sprite's direction to change in either direction, by a certain number of degrees.
 
The "turn ___ degrees left/right" blocks cause the sprite's direction to change in either direction, by a certain number of degrees.
  
==Point Toward==
+
===Point Toward===
 
The point toward block changes the sprite's direction to point toward a given object, or the mouse.
 
The point toward block changes the sprite's direction to point toward a given object, or the mouse.
  
==Point in Direction==
+
===Point in Direction===
 
This block sets the direction to a given value.
 
This block sets the direction to a given value.
  
==Go To==
+
===Go To===
 
The "Go To" block sets the position of a sprite in a single block.  It is the equivalent of a set X and set Y block combined.
 
The "Go To" block sets the position of a sprite in a single block.  It is the equivalent of a set X and set Y block combined.
  
==Set X/Y==
+
===Set X/Y===
 
These blocks set X and Y coordinates individually.
 
These blocks set X and Y coordinates individually.
  
==Change X/Y==
+
===Change X/Y===
 
These blocks increment or decrement the X and Y values.  Useful for speed-based advanced motion control.
 
These blocks increment or decrement the X and Y values.  Useful for speed-based advanced motion control.
  
==If On Edge, Bounce==
+
===If On Edge, Bounce===
 
For randomly-moving objects, this block prevents them from collecting on the edges.  It does what you would expect.
 
For randomly-moving objects, this block prevents them from collecting on the edges.  It does what you would expect.
  
==Turn==
+
==Looks==
The "turn ___ degrees left/right" blocks cause the sprite's direction to change in either direction, by a certain number of degrees.
+
===Show/Hide===
 
 
==Point Toward==
 
The point toward block changes the sprite's direction to point toward a given object, or the mouse.
 
 
 
==Point in Direction==
 
This block sets the direction to a given value.
 
 
 
==Go To==
 
The "Go To" block sets the position of a sprite in a single block.  It is the equivalent of a set X and set Y block combined.
 
 
 
==Set X/Y==
 
These blocks set X and Y coordinates individually.
 
 
 
==Change X/Y==
 
These blocks increment or decrement the X and Y values.  Useful for speed-based advanced motion control.
 
 
 
==If On Edge, Bounce==
 
For randomly-moving objects, this block prevents them from collecting on the edges.  It does what you would expect.
 
 
 
=Looks=
 
==Show/Hide==
 
 
These blocks change the visibility of a sprite.
 
These blocks change the visibility of a sprite.
  
==Switch Costume==
+
===Switch Costume===
 
Each sprite can have multiple costumes.  This command changes the costume to any costume in the sprite's selection.
 
Each sprite can have multiple costumes.  This command changes the costume to any costume in the sprite's selection.
  
==Switch Backdrop==
+
===Switch Backdrop===
 
The backdrop can be altered from any sprite's code.  This block works like Switch Costume.
 
The backdrop can be altered from any sprite's code.  This block works like Switch Costume.
  
==Change/Set Size==
+
===Change/Set Size===
 
These blocks function to change the size of an object or set it.
 
These blocks function to change the size of an object or set it.
  
=Sounds=
+
==Sounds==
==Default Sounds==
+
===Default Sounds===
 
These can be accessed through the "Play Sound" block.  There's a variety of soundbites.  They must be downloaded from a menu in the Sounds tab.
 
These can be accessed through the "Play Sound" block.  There's a variety of soundbites.  They must be downloaded from a menu in the Sounds tab.
  
==Recorded Sounds==
+
===Recorded Sounds===
 
You can record your own sounds in the Sounds menu.  Then, you can play them like default sounds.
 
You can record your own sounds in the Sounds menu.  Then, you can play them like default sounds.
  
==Musical Notes and Drums==
+
===Musical Notes and Drums===
 
Scratch offers a musical note system, including volume and tempo controls.  There are many drums and instruments which can play any note for any amount of time.
 
Scratch offers a musical note system, including volume and tempo controls.  There are many drums and instruments which can play any note for any amount of time.
  
=Variables=
+
==Variables==
==Local and Global Variables==
+
===Local and Global Variables===
 
When you first create a variable, you must decide whether it is particular to the sprite in which it is created, or global for the whole program.  '''This cannot be changed!'''
 
When you first create a variable, you must decide whether it is particular to the sprite in which it is created, or global for the whole program.  '''This cannot be changed!'''
==Showing and Hiding Variables==
+
===Showing and Hiding Variables===
 
You can reposition variable displays manually.  Moreover, you can change their visibility using these blocks.
 
You can reposition variable displays manually.  Moreover, you can change their visibility using these blocks.
  
==Changing and Setting==
+
===Changing and Setting===
 
Scratch offers an assignment block (Set ____ To ____) and an increment/decrement block (Change ____ By ____).  Each is fairly self-explanatory.
 
Scratch offers an assignment block (Set ____ To ____) and an increment/decrement block (Change ____ By ____).  Each is fairly self-explanatory.
  
=Events/Headers=
+
==Events/Headers==
==Flag Event==
+
===Flag Event===
 
Any code that has as its header "When <green flag> is clicked" will execute as soon as the program starts.
 
Any code that has as its header "When <green flag> is clicked" will execute as soon as the program starts.
  
==Click Event==
+
===Click Event===
 
Any code that has as its header "When <this sprite/the backdrop> is clicked" will execute every time the object is clicked by the mouse.
 
Any code that has as its header "When <this sprite/the backdrop> is clicked" will execute every time the object is clicked by the mouse.
  
==Key Press Event==
+
===Key Press Event===
 
Any code that has that header will execute when the selected key is pressed.
 
Any code that has that header will execute when the selected key is pressed.
  
==Message Event and Broadcasts==
+
===Message Event and Broadcasts===
 
Sprites can influence each other via broadcasting messages.  New messages can be created, and then the sprites will respond the same way no matter who sends a given message.
 
Sprites can influence each other via broadcasting messages.  New messages can be created, and then the sprites will respond the same way no matter who sends a given message.
  
=Control Statements=
+
==Control Statements==
==Waiting==
+
===Waiting===
 
Scratch offers two wait statements.  One sleeps that block of code for a given amount of time.  The other waits until a true/false statement becomes true.
 
Scratch offers two wait statements.  One sleeps that block of code for a given amount of time.  The other waits until a true/false statement becomes true.
  
==Loops==
+
===Loops===
 
Scratch has three loops:
 
Scratch has three loops:
Its forever loop will run until the program ends or a stop statement is reached.
+
:Its forever loop will run until the program ends or a stop statement is reached.
Its repeat ___ times loop will run a set number of times.
+
:Its repeat ___ times loop will run a set number of times.
Its repeat until loop will run until a certain condition is true.
+
:Its repeat until loop will run until a certain condition is true.
  
==Decisions==
+
===Decisions===
 
Scratch offers a simple if-then as well as an if-then-else.  These act as in other programming languages.
 
Scratch offers a simple if-then as well as an if-then-else.  These act as in other programming languages.
  
==Stop==
+
===Stop===
 
A stop statement can end all active code in any of the following:
 
A stop statement can end all active code in any of the following:
-All sprites and the backdrop
+
*All sprites and the backdrop
-The current sprite
+
*The current sprite
-All other sprites
+
*All other sprites
  
==Clones==
+
===Clones===
 
There are three clone blocks.
 
There are three clone blocks.
  
First, a sprite can create a clone of itself or any other sprite.
+
:First, a sprite can create a clone of itself or any other sprite.
Second, a clone can delete itself, ending a clone block of code.
+
:Second, a clone can delete itself, ending a clone block of code.
Third is the "when I start as a clone" header which is initiated for each new clone.
+
:Third is the "when I start as a clone" header which is initiated for each new clone.
  
=Sensing=
+
==Sensing==
==Touching==
+
===Touching===
 
A sprite can ask if it is touching the mouse, the edge of the screen, or any other sprite (collision handling).  It can also ask if it is touching a certain color.  Thus, colors can gain significance beyond simple aesthetics.
 
A sprite can ask if it is touching the mouse, the edge of the screen, or any other sprite (collision handling).  It can also ask if it is touching a certain color.  Thus, colors can gain significance beyond simple aesthetics.
  
==Mouse==
+
===Mouse===
 
A sprite can determine whether the mouse is pressed, as well as the mouse's location.
 
A sprite can determine whether the mouse is pressed, as well as the mouse's location.
  
==Distance==
+
===Distance===
 
A sprite can determine the distance between it and any object/mouse.
 
A sprite can determine the distance between it and any object/mouse.
  
==Key Press==
+
===Key Press===
 
A sprite can determine if a given key is being pressed.
 
A sprite can determine if a given key is being pressed.
  
==Other Sprites==
+
===Other Sprites===
 
The ____ of ____ offers sprites the opportunity to check on the state of other sprites, such as their position and costume.
 
The ____ of ____ offers sprites the opportunity to check on the state of other sprites, such as their position and costume.
  
==Timer==
+
===Timer===
 
Scratch offers a single timer which can be reset to 0 at any time.  The sprites can see what time is on the timer.
 
Scratch offers a single timer which can be reset to 0 at any time.  The sprites can see what time is on the timer.
  
==Asking==
+
===Asking===
 
The backdrop has a block "Ask ____" which gets text input from the user.  This input can be accessed via the "answer" block.
 
The backdrop has a block "Ask ____" which gets text input from the user.  This input can be accessed via the "answer" block.
  
=Operators=
+
==Operators==
 
Scratch offers the basic arithmetic operators, functions like sine, cosine, square root, and absolute value, boolean operators (and, or, and not), as well as some string functions.
 
Scratch offers the basic arithmetic operators, functions like sine, cosine, square root, and absolute value, boolean operators (and, or, and not), as well as some string functions.
  
=DOs and DON'Ts=
+
==DOs and DON'Ts==
==Don't: Say/Think==
+
===Don't: Say/Think===
 
Don't use the say or think blocks on sprites, or the ask block on sprites.  The word bubbles produced are unprofessional.
 
Don't use the say or think blocks on sprites, or the ask block on sprites.  The word bubbles produced are unprofessional.
  
==Do: Friction==
+
===Do: Friction===
 
The following block of code added to a motion loop will create a friction effect:
 
The following block of code added to a motion loop will create a friction effect:
 
set Speed to (Speed * 0.9)
 
set Speed to (Speed * 0.9)
  
=Advanced Options=
+
==Advanced Options==
==Trails with the Pen==
+
===Trails with the Pen===
 
Create a trail of any sprite's motion using the pen (green) blocks!
 
Create a trail of any sprite's motion using the pen (green) blocks!
  
==More Blocks==
+
===More Blocks===
 
You can define procedures and functions using the Purple section.  This can help your code organization.
 
You can define procedures and functions using the Purple section.  This can help your code organization.
  
==Lists Mean Levels==
+
===Lists Mean Levels===
 
Use a list (found under Variables) to define parameters for multiple levels of play.
 
Use a list (found under Variables) to define parameters for multiple levels of play.
  
==Time==
+
===Time===
 
Scratch can access the current day and time in the Sensing section.
 
Scratch can access the current day and time in the Sensing section.
  
=Types of Sprite=
+
==Types of Sprite==
==The Message==
+
===The Message===
 
This sprite has text as its costume.  It delivers a message, such as winning or losing.
 
This sprite has text as its costume.  It delivers a message, such as winning or losing.
==The Player==
+
===The Player===
 
This sprite uses a forever loop to have continuous motion.
 
This sprite uses a forever loop to have continuous motion.
==The Autonomous Sprite==
+
===The Autonomous Sprite===
 
This sprite needs to use blocks like If On Edge Bounce to avoid clumping on edges.  Use clone to create many of these.
 
This sprite needs to use blocks like If On Edge Bounce to avoid clumping on edges.  Use clone to create many of these.
==The Button==
+
===The Button===
 
This sprite uses the Click event and broadcasting to cause major changes in the program.
 
This sprite uses the Click event and broadcasting to cause major changes in the program.
==The Master==
+
===The Master===
 
An invisible sprite that does heavy processing.  This is the core of the program.  The backdrop can also take this role.
 
An invisible sprite that does heavy processing.  This is the core of the program.  The backdrop can also take this role.
 +
{{Inquiry Event}}
 +
[[Category:Inquiry and Nature of Science Events]]
 +
[[Category:Event Resources]]

Latest revision as of 05:58, 17 May 2020

This is a list of blocks that are useful for Game On.

Motion

Move

The block "move ____ steps" causes the sprite to move in the preset direction, a certain number of "steps". A typical noticeable motion is 5-10 steps.

Turn

The "turn ___ degrees left/right" blocks cause the sprite's direction to change in either direction, by a certain number of degrees.

Point Toward

The point toward block changes the sprite's direction to point toward a given object, or the mouse.

Point in Direction

This block sets the direction to a given value.

Go To

The "Go To" block sets the position of a sprite in a single block. It is the equivalent of a set X and set Y block combined.

Set X/Y

These blocks set X and Y coordinates individually.

Change X/Y

These blocks increment or decrement the X and Y values. Useful for speed-based advanced motion control.

If On Edge, Bounce

For randomly-moving objects, this block prevents them from collecting on the edges. It does what you would expect.

Looks

Show/Hide

These blocks change the visibility of a sprite.

Switch Costume

Each sprite can have multiple costumes. This command changes the costume to any costume in the sprite's selection.

Switch Backdrop

The backdrop can be altered from any sprite's code. This block works like Switch Costume.

Change/Set Size

These blocks function to change the size of an object or set it.

Sounds

Default Sounds

These can be accessed through the "Play Sound" block. There's a variety of soundbites. They must be downloaded from a menu in the Sounds tab.

Recorded Sounds

You can record your own sounds in the Sounds menu. Then, you can play them like default sounds.

Musical Notes and Drums

Scratch offers a musical note system, including volume and tempo controls. There are many drums and instruments which can play any note for any amount of time.

Variables

Local and Global Variables

When you first create a variable, you must decide whether it is particular to the sprite in which it is created, or global for the whole program. This cannot be changed!

Showing and Hiding Variables

You can reposition variable displays manually. Moreover, you can change their visibility using these blocks.

Changing and Setting

Scratch offers an assignment block (Set ____ To ____) and an increment/decrement block (Change ____ By ____). Each is fairly self-explanatory.

Events/Headers

Flag Event

Any code that has as its header "When <green flag> is clicked" will execute as soon as the program starts.

Click Event

Any code that has as its header "When <this sprite/the backdrop> is clicked" will execute every time the object is clicked by the mouse.

Key Press Event

Any code that has that header will execute when the selected key is pressed.

Message Event and Broadcasts

Sprites can influence each other via broadcasting messages. New messages can be created, and then the sprites will respond the same way no matter who sends a given message.

Control Statements

Waiting

Scratch offers two wait statements. One sleeps that block of code for a given amount of time. The other waits until a true/false statement becomes true.

Loops

Scratch has three loops:

Its forever loop will run until the program ends or a stop statement is reached.
Its repeat ___ times loop will run a set number of times.
Its repeat until loop will run until a certain condition is true.

Decisions

Scratch offers a simple if-then as well as an if-then-else. These act as in other programming languages.

Stop

A stop statement can end all active code in any of the following:

  • All sprites and the backdrop
  • The current sprite
  • All other sprites

Clones

There are three clone blocks.

First, a sprite can create a clone of itself or any other sprite.
Second, a clone can delete itself, ending a clone block of code.
Third is the "when I start as a clone" header which is initiated for each new clone.

Sensing

Touching

A sprite can ask if it is touching the mouse, the edge of the screen, or any other sprite (collision handling). It can also ask if it is touching a certain color. Thus, colors can gain significance beyond simple aesthetics.

Mouse

A sprite can determine whether the mouse is pressed, as well as the mouse's location.

Distance

A sprite can determine the distance between it and any object/mouse.

Key Press

A sprite can determine if a given key is being pressed.

Other Sprites

The ____ of ____ offers sprites the opportunity to check on the state of other sprites, such as their position and costume.

Timer

Scratch offers a single timer which can be reset to 0 at any time. The sprites can see what time is on the timer.

Asking

The backdrop has a block "Ask ____" which gets text input from the user. This input can be accessed via the "answer" block.

Operators

Scratch offers the basic arithmetic operators, functions like sine, cosine, square root, and absolute value, boolean operators (and, or, and not), as well as some string functions.

DOs and DON'Ts

Don't: Say/Think

Don't use the say or think blocks on sprites, or the ask block on sprites. The word bubbles produced are unprofessional.

Do: Friction

The following block of code added to a motion loop will create a friction effect: set Speed to (Speed * 0.9)

Advanced Options

Trails with the Pen

Create a trail of any sprite's motion using the pen (green) blocks!

More Blocks

You can define procedures and functions using the Purple section. This can help your code organization.

Lists Mean Levels

Use a list (found under Variables) to define parameters for multiple levels of play.

Time

Scratch can access the current day and time in the Sensing section.

Types of Sprite

The Message

This sprite has text as its costume. It delivers a message, such as winning or losing.

The Player

This sprite uses a forever loop to have continuous motion.

The Autonomous Sprite

This sprite needs to use blocks like If On Edge Bounce to avoid clumping on edges. Use clone to create many of these.

The Button

This sprite uses the Click event and broadcasting to cause major changes in the program.

The Master

An invisible sprite that does heavy processing. This is the core of the program. The backdrop can also take this role.