2D - SDG 3 - Care Bots for Older Persons (Difficulty: 1)
CreatiCode last edited by info-creaticode
- Arrow blocks for moving
- Say Things
- Set or Change Sprite Size
- Paint Costumes
- Switch Costumes
- Broadcasting messages
- Hiding or showing sprites
The SDGs are 17 goals adopted by the United Nations in 2015. They are a to-do list for everyone to work on together.
This tutorial is about the well-being of older persons, which is related to the 3rd goal of “good health and well-being”.
For people over 65 years old, many of them live alone at home. To take care of them, one solution is to use healthcare robots (“care bots”) in their home.
This project will show more people what care bots can do. Grandpa will ask a care bot named “Joy” to help him find his book, and the user will use the keyboard to control Joy to fetch the book.
First, please click this link to open the project template:
Click the “remix” button to make a remix project of your own. Note that you need to be signed in to do this. If you are not signed, please sign in first, then click the above link again to load the project.
This project contains 4 sprites:
- The “Grandpa” sprite is the person who needs Joy’s help to fetch things;
- The “Joy” care bot has 16 costumes for walking in all 4 directions;
- The “Room” sprite contains a simple costume of the walls;
- The “Object” sprite contains some commonly used objects that Grandpa might be looking for, such as a book or glasses.
First, please select the stage, and use a rectangle to cover the entire costume. Pick a color that’s different from the sprites.
When the project starts, Grandpa needs to tell Joy what he is looking for. You can use the “say” block to show his request on the screen, such as “Joy, where is my book?” Note that you need to add these 2 blocks in the “Grandpa” sprite:
After saying the request, Grandpa will “tell” the “Object” sprite to move to a random place on the stage. He can do so by broadcasting a “Start” message after the “say” block:
In the “Object” sprite, when it receives the “Start” message, it should go to a random position.
Instead of showing the book to move randomly, we should hide it at the beginning, then show it after it has moved to a new position.
Now the book will be hidden at first, then show up in a random position:
Now let’s add some code to the “Joy” sprite. First of all, we would want Joy to always start at the center of the stage. This makes it easier for the player to get started.
When the player presses the right arrow key on the keyboard, we would like to make Joy turn to the right. There are 4 costumes with Joy facing the right “R1”, “R2”, “R3” and “R4”. We will just use “R2” for now.
We also need to make Joy move to the right a little bit using the right arrow block.
Now each time we press the right arrow key, Joy will move a bit to the right:
The code blocks for moving in the other 3 directions are very similar. Please also add them to the Joy sprite:
Now we can move Joy to anywhere on the stage:
Currently, Joy can walk through the walls in the room. To make the game more interesting, we can make Joy go back to the center point when it touches any wall.
Now test it out by making Joy walk into a wall:
When the player successfully moved Joy to the book object, we need to show a message. Please add a new sprite named “Success”, and draw a success message. Here is an example:
At the beginning of the game, we should hide the “Success” sprite. Please add these blocks to that sprite’s code:
When the Joy sprite touches the book object, we need to show the “Success” sprite.
First, we need to broadcast a new message “success”, whenever the Joy sprite touches the “Object” sprite. These blocks should go into Joy’s code:
In the “Success” sprite, when we receive the “success” message, we should show this sprite, and also move it to the center of the screen:
Now our game is ready:
There are many ways you can extend this project. Here are some examples:
Draw a Different Room: You can replace the “Room” sprite’s costume with your own drawings.
Find 2 Objects: You can change Grandpa to ask the player to find 2 objects instead of just one. The success condition needs to be changed as well.
This is my WIP and a few changes I’ve made. https://play.creaticode.com/projects/GcggcFcLPeaHDkGDF