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
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:
- Music is played in the background
- 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 Position, Y Position, direction, costume number, size, 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).
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.
Fillable Forms (CSEC Tutorial in Microsoft Word)
https://youtu.be/HnudH-ApOoM
Students to follow along with the video, using Microsoft word to –
1. Enable the developer tab.
2. Create a fillable form
3. Create a submit button : Submit A word processing form Via email
Optional content
Can you create a fillable form using google forms? Reproduce the fillable form from the example using google forms if you can.
Homework
Read and practise the example from Information Technology for CSEC – 3rd edition, Howard Campbell, pg 154-157.
© 2021 Vedesh Kungebeharry. All rights reserved.
Programming Practise in C Live Class 2021/11/16
See the video below:
https://youtu.be/gI1o_ZL5Ulw
© 2021 Vedesh Kungebeharry. All rights reserved.
Last Term 1 Class (Form 5 Option C [2021 22] )
See the video Below:
https://youtu.be/3diuvU3a9dM
© 2021 Vedesh Kungebeharry. All rights reserved.
Adding 2 numbers – real/floating point numbers
0004
Exercise 1 : Modify your code from the previous example to use floating point numbers 5.1 and 6.1
- Teacher modifies variable declarations, but leaves prinf to output integer values.
- The erroneous result is observed and explained: the binary data stored at the variables are calculated and interpreted to show an integer result.
- Teacher modifies the code of printf() to use %d and now the correct result is shown.
Exercise 2:
Observe what is output when %d is changed to each of the following, one at a time:
%d for int
%f for float
%lf for double
%c for char
%s for string
Video Demonstration
https://youtu.be/Be_QtiweYTY
You can download the files here: https://drive.google.com/file/d/1nVXCOXTJkPYNSs2jDwxGGbz9mvuKooDK/view?usp=sharing
Code
#include <stdio.h>
#include <stdlib.h>
int main()
{
//declare and identify variables
float a,b;
float c;
//Initialize the variables
a=5.1;
b=6.1;
//Perform processing c <-- a+b
c=a+b;
printf("The sum of %.1f and %.1f is %.f \n", a,b,c);
}
© 2021 Vedesh Kungebeharry. All rights reserved.
Adding 2 numbers – Outputting the result with printf()
0003-OutputResults
Exercise: Modify your previous code to output results using printf()
Video Demonstration
https://youtu.be/YE0V_XLuOx8
You can download the file used in the video here: https://drive.google.com/file/d/1A4oCHsdXW0Ab7ox-T_zXi3eVmrQkXoic/view?usp=sharing
Code
#include <stdio.h>
#include <stdlib.h>
int main()
{
//declare and identify variables
int a,b;
int c;
//Initialize the variables
a=5;
b=6;
//Perform processing c <-- a+b
c=a+b;
printf("The sum of %d and %d is %d \n", a,b,c);
}
© 2021 Vedesh Kungebeharry. All rights reserved.
Adding 2 numbers – (Declaring integer variables, Watching Variables)
0002-ADDING 2 integers , 5 and 6 no output
Exercise 1
- Write code which declares 2 integer variables A and B . Initialize A to 5 and B to 6. Use a third variable , C to store the result of A+B.
- Verify addition has occurred by using the variable watch window.
Demonstration Video
https://youtu.be/nfGwWUIZDaY
Download the files here: https://drive.google.com/file/d/15PfdndUqvnd_fLYPzctsgZMG4I9oSYtx/view?usp=sharing
Code
#include <stdio.h>
#include <stdlib.h>
int main()
{
//declare and identify variables
int a,b;
int c;
//Initialize the variables
a=5;
b=6;
//Perform processing c <-- a+b
c=a+b;
}
© 2021 Vedesh Kungebeharry. All rights reserved.
Your First Program Using Codeblocks IDE
0001 Your first program
*Using Codeblocks 17.12
1. Create a new Project

2.Select “Console Application” and click on go.

3.Select “C” and click next.

4. Give your project a title and optionally select a folder where you want the project to be created. In this case we use “Upper camel case”` : “0001-MyFirstProgram”

5.Leave all settings as default and choose finish:

6. Open main.c from the tree on the left. [1] Expand sources, [2]then double click on “main.c”.

7. Click on Build, and choose build and run.

8. Your code is now built to an executable file, and the program is executed in the console window:

Exercises
- What happens when “Hello world!\n” is changed to “Hello world!” and the program is run?
- Modify the printed message to say “Goodbye”.
You can download the project here:
https://drive.google.com/drive/folders/1-oDom6OVimkNZeBACsJs9FZ0byhsNXHv?usp=sharing
The code is shown below:
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("Goodbye world!");
return 0;
}
© 2021 Vedesh Kungebeharry. All rights reserved.
Information Processing Review (Live Class)
See the video that was recorded today (11th Nov 2021)
https://youtu.be/0zr7E4WZLNk
© 2021 Vedesh Kungebeharry. All rights reserved.