Zmiany

Skocz do: nawigacji, wyszukiwania

Module 2 - The “Cat Chasing a Mouse” Project

Dodane 4801 bajtów, 23:22, 6 lip 2015
We ask that students to find the option to insert a new sprite, and then to add it by selecting the Mouse from among the available ready characters. If necessary, we suggest (prompt the students) that animals figures are available in the Animals category and demonstrate how to add the sprite.
[[Plik:Scr_old_e_2_1.jpg|center]]
We explain to the students that we now have two sprites that will be the characters in our game. We note that they have rather unfriendly names (Sprite1, Mouse1), which can interfere and cause confusion if we want to control them.
''Students should note that they can change the name of the sprite in the settings after selecting the'' '''i''' ''symbol by the sprite icon at the bottom of the screen (under the stage).''
[[Plik:Scr_old_e_2_2.jpg|center]]
'''Task: '''
We propose that students reduce the Mice sprite character and set up the characters so that they do not to hide behind each other. We remind them that we have already done this once.
{| class="wikitable" style="font-style: italic; margin: auto;"|- style="vertical-align:top;"|[[Plik:Tip_ikonka.png]]|'''Tip'''<br/>If necessary, we remind the students that to zoom in and out the sprite we use the icons:<br/>[[Plik:Scr_old_e_2_12.jpg]]<br/>We select them, and then click on the sprite until we get the desired size.|}
We explain that now we will learn to change the stage background.
: ''We have gone to the '''stage''' edit mode.''
[[Plik:Scr_old_e_2_3.jpg|center]]
'''Task: '''
'''Task: '''
We ask that students to find the block which lets us change the sprite’s viewing direction (sprite setting) in the direction of the mouse cursor. If necessary, we suggest that it is in the category of '''Movement.'''
: ''Students should find the block '''Turn to <moue mouse pointer>.''' They can also find '''Goto <mouse pointer>.''' If they find the latter, we do not ask them to change it. We say that in that case we will test both and see which will suit us better. '' 
[[Plik:Scr_old_e_2_4.jpg]]
'''Task: '''
: ''Students have already created an animation script using the '''always''' loop. If necessary, prompt them that this script should work similarly, that is always after the programme is started the Mouse should look in the direction of the mouse pointer. ''
[[Plik:Scr_old_e_2_5.jpg]]
{| class="wikitable" style="font-style: italic; margin: auto;"|- style="vertical-align:top;"|[[Plik:Tip_ikonka.png]]|'''Tip'''<br/>If someone chose the '''go to <mouse pointer>''' block, we discuss the difference this makes in how the scripts work. In this case the Mouse sprite is exactly where the mouse pointer is. So we cannot give it speed (which depends on how quickly we move the computer mouse). The Mouse sprite also does not rotate in the direction of the pointer.|}
'''Task: '''
We explain that the Mouse already knows where the computer mouse pointer is and is all the time looking at it. We ask the students to modify the script so that the Mouse moves in the direction of the mouse pointer, i.e. the direction in which it is looking. We remind them that we know which block allows us to move our Mouse.
[[Plik:Scr_old_e_2_6.jpg]]
'''We ask the following question: '''
: ''The Mouse in this case should move much more slowly, but also more precisely, because it is looking for the mouse pointer more often (after fewer steps), and so it more often adjusts the direction in which it should move. We propose to leave this speed. ''
 
{| class="wikitable" style="font-style: italic; margin: auto;"
|- style="vertical-align:top;"
|[[Plik:Tip_ikonka.png]]
|'''Tip'''<br/>At this point, it is worth showing the students that there are three behaviour options that can be set for every sprite. To show this we need to click the appropriate sprite in the sprite management area, and then select the '''i''' symbol:<br/>[[Plik:Scr_old_e_2_7.jpg|center]]<br/>Three behaviour icons will appear on the right side of the sprite. The first one: is used to make the spirit rotate in the direction in which it is looking (this is the default setting). The second icon: indicates that the sprite only rotates left – right, depending on the direction it is facing. If we select the last icon: the sprite will not rotate at all, regardless of the direction set.
|}
: ''Ideas will probably vary, ranging from an explosion to the Mouse being eaten. We should prompt the students to get the Mouse to think e.g. “Oh, the Kitten has caught me!” and stop. We discuss what blocks we can use in this case, in what order, and in which part of the Mouse script. We write down subsequent ideas on the board – for example: ''
[[Plik:Scr_old_e_2_8.jpg]]
{| class="wikitable" style="font-style: italic; margin: auto;"
|- style="vertical-align:top;"
|[[Plik:Tip_ikonka.png]]
|'''Tip'''<br/>It is worthwhile to discuss with the students whether a conditional instruction should be placed before or after the instruction '''Move by 2 steps'''. We can argue that the Mouse should first check whether it is touching the Kitten or not, because the Kitten may have caught it. If it moves first, it could manage to escape the Kitten, even though it has already been caught (touched).<br/>We should also discuss whether we should use the command '''Stop this script''' or '''Stop everything.''' The first one seems better because it is the Mouse which has been caught and so the Mouse should stop. The Kitten may still do things – for example say something or make a sound. That is why we should not use the command '''Stop everything,''' because in that case we would stop the whole programme immobilizing also the Kitten.
|}
[[Plik:Scr_old_e_2_9.jpg]]
{| class="wikitable" style="font-style: italic; margin: auto;"|- style="vertical-align:top;"|[[Plik:Tip_ikonka.png]]|'''Tip'''<br/>A common mistake at this stage is to place the block move by 2 steps in the condition if it touches the Kitten after the block stop this script. In this case the Mouse is stationary, because the movement will never be executed.|}
: ''Answers may vary, but we prompt the students that in many games (e.g. Angry Birds) we always start from the same position (we have the same chance of winning). That is why it is worth entering into the script a command which will set the Mouse in a certain position after starting the programme. ''
{| class="wikitable" style="font-style: italic; margin: auto;"
|- style="vertical-align:top;"
|[[Plik:Tip_ikonka.png]]
|'''Tip'''<br/>Because students may be unfamiliar with the Cartesian coordinate system, at this point we can give them a brief introductory presentation by drawing the coordinate system on the board. Then we show them how to read a given sprite’s position in Scratch.<br/>[[Plik:Scr_old_e_2_10.jpg|center]]
|}
'''Task:'''
: ''Students should find the blocks '''got to x: y:''' and '''set the direction to <90>.''' They should not find it difficult set the direction '''to the left (-90)''' – one of the additional tasks in Module I was to set the sprite facing a specific direction (up, down, left, right). ''
[[Plik:Scr_old_e_2_11.jpg]]
: ''Students often incorrectly place blocks in the script (in the '''always''' loop instead of before it). If necessary, we ask a student who has managed to properly insert the blocks to demonstrate the right solution, and then we start a discussion about what would happen if we placed the blocks somewhere else. ''
[[Plik:Scr_old_e_2_14.jpg]]
We ask the students to create an appropriate script. We help them if necessary.
[[Plik:Scr_old_e_2_13.jpg]]
{| class="wikitable" style="font-style: italic; margin: auto;"|- style="vertical-align:top;"|[[Plik:Tip_ikonka.png]]|'''Tip'''<br/>Please note, that students should be made aware that if the Kitten says “I’ve caught the Mouse!” and immediately stops everything, it may happen that the Mouse script won’t have enough time to check that the Mouse is touching the Kitten and display “Oh, the Kitten has caught me!”. This is why it is worth using the following block in the Kitten script<br/>'''say <I’ve caught the Mouse!> for 2 seconds'''|}
'''Task: '''
We draw the students’ attention to the fact that by default the Kitten has two costumes that differ in how its legs are arranged. We propose that students create an additional script for the Kitten causing the Kitten to swing its legs. We remind the students that during the previous class we already animated the sprite.
[[Plik:Scr_old_e_2_15.jpg]]
* Creating their own background for the game (created in the graphics editor; it is also possible to use a photo taken by students or downloaded from the web).
 
<span style="color: red">'''''Note!!!''''' </span>
: ''For images downloaded from the Internet we should make sure whether their use in the project is legal. We can also show the students from where they can legally download graphics for their projects. Preparing (searching) graphics by the students for the background in class is not advisable due to the unnecessary waste of time. We should also tell our students that the background should have the following dimensions: 480 by 360 points.''
197
edycji