NCSE ICT – Scratch Programming – Manipulating sprites

Tutorial using scratch cards

Follow the tutorials in this pdf document (scratch2cards_jan2013.pdf)

https://drive.google.com/file/d/1sG6pRMYRAmM5VP4WOSeYXAtWm81Ietdo/view?usp=share_link

The above file and 2 others are in the following google drive folders for your reference:

https://drive.google.com/drive/folders/1-OElNjqODc1RVdUFGVe1LXuR6kJYAE_D?usp=share_link

Changing color

Color Example 1

Color Example 2


Credit: The following section was taken from : https://en.scratch-wiki.info/wiki/Graphic_Effect#Color

Color

One costume can take on 200 different color-schemes using the color effect. The “real” effect of the color is equal to the numeric/stored effect modulo 200. This means that changecoloreffectby200 will do nothing since the rendered color will be the same.

“Change color effect” will have a little apparent effect on sprites colored black, as black is a desaturated color rather than its own hue. To see the color effect on a black sprite, increase its brightness first. Similarly, sprites colored white will have little noticeable effect when the “Change color effect” block is used.

Changing of colors using the Color Effect block

These are the color changes from Scratch Cat Orange (0 Color Effect) to itself when it restarts at the 200th positive value of the color effect.

  • 1-10 = Orange to light yellow
  • 10-20 = Light yellow to a yellowish-green
  • 20-30 = Yellowish-green to a medium green color
  • 30-40 = Medium green to a thick, green color.
  • 40-50 = No considerate change.
  • 50-60 = A greenish-light cyan color.
  • 60-70 = A lightly-blue tinted green to a fully light cyan color.
  • 70-80 = A light cyan color to a light blue color.
  • 80-90 = A light blue to a medium-dark blue.
  • 90-100 = A medium-dark blue a thick dark blue.
  • 100-110 = Darker and darker blue.
  • 110-120 = A slowly more purplish-blue.
  • 120-135 = Violet to Indigo
  • 135-160 = A gradually mixed pink and purple.
  • 160-170 = A gradually pinkish-red color.
  • 170-180 = A thick red color.
  • 180-190 = A dark orange color
  • 190-200 = Identical to the original color at this point.

For other colors, simply start at the most similar color effect. If you are still not sure, try changing the color effect until it matches one of these descriptions.

Credit: The above section was taken from : https://en.scratch-wiki.info/wiki/Graphic_Effect#Color


Moving a sprite to music (By changing costumes)

To accomplish this, we set up a scenario where:

  1. Music is played in the background
  2. We cycle through a sprite’s costumes using a forever block

See: Moving a sprite to music (By changing costumes) example. Make sure to investigate the sound tab to see how sounds are imported and used.


Credit: The section below was taken from: https://en.scratch-wiki.info/wiki/Costume#Uses Be sure to follow the link to view additional examples of how this block can be used

Blocks

There are four blocks that relate to costumes, which are as follows:

The first three blocks can be located in the Looks block section, while the fourth can be found in the Sensing block area.

Uses

  • The first block is used for the sprite to transfer its look between any of its costumes.
  • The second block is mainly used in animation. A block that does the opposite has been suggested, but it can simply be done with the following code:
switchcostumetocostume#-1
  • The third block contains the number of the current costume being used. It can be read through other blocks, and specific actions can be taken.
  • The fourth block contains two drop-down boxes. The first allows you to read a sprite’s X PositionY Positiondirectioncostume numbersize, and volume; while it can also read the Stage‘s background number and volume.

This block can be read from the Stage and all sprites.

Credit: The section above was taken from: https://en.scratch-wiki.info/wiki/Costume#Uses Be sure to follow the link to view additional examples of how this block can be used


Moving a sprite with the keyboard

See the link https://islandclass.org/2021/01/13/making-a-sprite-jump-in-scratch/

Talking Sprites

We can use the “Say” block to make sprites talk. See the tutorial below for more detail:

Tutorial: https://scratch.mit.edu/projects/editor/?tutorial=tell-a-story

Exercises in scratch cards: https://resources.scratch.mit.edu/www/cards/en/story-cards.pdf


Credit: the following section was taken from: https://en.scratch-wiki.info/wiki/Say_()for()Seconds(block). Be sure to follow the link to view additional examples of how this block can be used

Say () for () Seconds (block)

“Say” redirects here. For the other say block, see Say () (block).

Say () for () Seconds
sayforseconds
CategoryLooks
TypeStack
Introduced in1.0

The Scratch Cat saying “Hello!” with the Say block

The say () for () seconds block is a looks block and a stack block. The block displays a speech bubble with the specified text for the sprite that runs it, which appears on the screen for the specified amount of seconds.

The block is similar to the think () for () seconds block, with the difference being that this block displays a speech bubble, while the other displays a thought bubble. It is also similar to the say () block, with the exception that the other block makes the sprite say something indefinitely.

This block was titled “Say () for () Secs” prior to Scratch 3.0.

Credit: the above section was taken from: https://en.scratch-wiki.info/wiki/Say_()for()Seconds(block). Be sure to follow the link to view additional examples of how this block can be used


Sprite movement

This can be accomplished by using the move or glide blocks

Click here for an example of Move and glide blocks

See more detail here : https://en.scratch-wiki.info/wiki/Motion_Blocks

Updates

27th April 2023: Added “Tutorials using scratch cards” at the top of the note.

© 2021  Vedesh Kungebeharry. All rights reserved. 

© 2022  Vedesh Kungebeharry. All rights reserved. 

Catch by Coordinate – Scratch Game Assignment

The following task was discussed in class today:

Task : Create a game where a sprite moves around a few times to a random position and asks the player (user) to guess his x and y coordinates. If both the x and y coordinates entered by the player are within 10 units of the sprites location, say a message which indicates success, otherwise, say that the player missed and tell the player to try again.

A sample of blocks below shows how to move the sprite around:

© 2021  Vedesh Kungebeharry. All rights reserved.