Zmiany

Skocz do: nawigacji, wyszukiwania

Module 3 - The “Cat in a Maze” Project

Dodane 71 bajtów, 09:59, 7 lip 2015
/* Designing a game involving going through a maze */
We begin the discussion of how we should describe the behaviour of the character (sprite), and how we are going to control it: <br/>
'''Question:''' With what should the game start after it is initiated? <br/>
:::''There may be various suggestions. We should prompt the students that our character should be placed in the middle of the starting square. It should be noted that the sprite character should entirely fit in a single maze square, so as not to touch its walls.''
'''Question:''' How will we control the character? <br/>
:::''What button are we going to use to make our character go forward? Should it move forever?'' <br/>:::''– We guide the students to find the answer “No,” because it will collide with a maze wall.'' <br/>
:::''How many steps should it now take?'' <br/> :::''– Enough to move from one square to the next, adjacent one. We discuss what this means, pointing to the maze drawing on the board. Together we reach the conclusion that the character should move forward a number of steps that is equal to the length of the side of a single field in our maze.'' <br/>
:::''In this case, should we choose to control the character with the computer mouse or the keyboard?'' <br/>:::''– In this game it will be easier to control the character using the keyboard.''<br/>
:::''After discussing which key should make the character move by one square, we write on the board what we have agreed on, for example:''<br/>:::'''* ''When the up arrow key is pressed, go forward by “one square.''”'''
'''Question:''' How should the computer react if the character collides with a maze wall? <br/>
:::''There will be various answers, such as: the character dies, the game starts from the beginning, etc. We hint that if we do not want the game to end too quickly, it will be enough for the character to bounce off the wall and return to its previous place. Additionally, it can emit a sound, e.g. meow.'' <br/>
:::''We add the following to the previous record, e.g.'' <br/>:::'''''* If the character collides with a wall, go back to where it was previously located, and then: '''''<br/>:::'''''* Play a meow sound''.'''<br/>
'''Question:''' How can we rotate the character, so that it walks in a different direction? <br/>
:::''There will be various suggestions. We write down one of them on the board.
NOTE: At this point we discuss how the character is to move (up, down, left, right). We explain how it can rotate. We remind the students of how we drew a square in the first module and rotated the sprite by 90 degrees to the left or right. We guide the students towards a solution where the character is rotated left or right.'' <br/>
:::''After discussing which key should control the character, we write on the board what we have agreed on, for example:'' <br/>:::'''''* When the right arrow key has been pressed, rotate the character by 90 degrees to the right.''''' <br/>:::'''''* When the left arrow key has been pressed, rotate the character by 90 degrees to the left.''''' <br/>
'''Question:''' What should happen when the character reaches the exit? <br/>
:::''We discuss how the game is to end. Let our hero make a sound and display the word “Exit!” in a speech bubble. This is the end of the game, so we should stop all scripts.'' <br/>
'''We ask the following question:''' Which of the above tasks can we already accomplish? <br/>
:::''– Move the character (we do not yet know how far the character is to be moved)'' <br/>:::''– Rotate the character 90 degrees to the left or right by pressing a given key'' <br/>:::''– Change the stage background. '' <br/>
'''We ask the following question:''' What do we have to learn? <br/>
:::''– How to recognise that the character has walked into a wall, i.e. a prohibited stage area, or reached the exit'' <br/>:::''– How to move the character backwards, i.e. reverse it'' <br/>:::''– How to play sounds (unless we have introduced this command earlier in class or as homework / an additional task).'' <br/> 
===Preparation: recognition of the background colour by the sprite===
568
edycji