Friday, October 20, 2017

Cat and Mouse Game: Palacios and Kulzer

Report: Cat and Mouse












We needed to use this blocks to make different codes obligatory: 


And this is how we created our game "Cat and Mouse":


You are the mouse. With the mouse pointer, you decide where to go with your mouse through the maze to fetch the cheese. Inside it, we can see a cat. It moves by itself and if the cat touches you, the game ends because you failed. When you fetch the cheese, a bowl is going to appear down on the right corner. The mouse should go out of the maze avoiding the cat and place the cheese in the bowl. When the mouse touches this bowl, the cheese will be over it, the programme will stop and you'll win. If you want to play again, the only thing you must do is click on the green flag. Also, there are walls in the maze. The cat and the mouse can't go through them. If the cat touches a wall, it immediately changes the direction of where it was going. If the mouse touches a wall, it goes teleported out of the maze, and you will need to go through the maze again so no one could cheat and it was more difficult to complete the game.

Let see how we made those things:

The mouse:
How the programme starts:

When the green flag is pressed, the mouse must be shown in that exact location, and look to 90º.

How we made it move:


If the mouse pointer is 2 far away, the mouse walk where the mouse pointer points. It also will look where the mouse pointer is. If it goes to one edge of the maze it bounces, so it won't get "out of the game".

How it can't go through walls:


When the mouse touches the blue color (the walls of the maze) it is bigger because it goes over the walls to that coordinates. When it's there, it becomes smaller because it is not over the walls anymore. We placed the ".... and ....." block because, for some reason, the mouse could go ahead some walls. To make us sure that it couldn't do it any longer, we placed that block.

How you lose:




When the mouse touches the cat, it hides. Then, the backdrop switches to one which says: "You lose! Click on the green flag to play again!". A broadcast named "lost" is sent. What it does, is that every sprite must hide. Then, the programme stops.

How you win:


When the mouse touches the Bowl,  it sends the broadcast show. What it does, is sending a message to the cheese, that it must appear inside the bowl. When the cheese touches the bowl, you automatically win!

In addition...


When the message "hide" is sent, it means that the cat should hide, because you won.


The cat:


How the programme starts:


When the green flag is clicked, the backdrop switches to the maze, the cat is shown, and it appears in that exact location.

How we made it move and that it doesn't cross any wall:


The cat moves every time 2 steps forward. If the cat touches the blue color (like we explained before, the walls of the maze) it goes 25 steps back ( and three more so we are sure it goes back) and it turns to the right in "x" degrees. (because it picks a random number from 1 to 3, so the cat could turn, 90, 180, or 270 degrees). And then, it goes 20 steps forward. This was made so when the cat touches the walls of the maze, it took a random location where to go.


How you can see here, these codes are for the outside part of the maze. Sometimes the cat went crazy, and liked to get out of the maze. To avoid this, we painted the outside part of the maze in this light green color. When the cat touches it, the cat becomes bigger, because its over the walls and being teleported to that exact location, so it can't go outside the maze. His size becomes then smaller (to its normal form).

In addition...


The one broadcast that says "hide" has the same meaning as how it works for the mouse. (It means that the mouse won). And the one below is when the mouse has been eaten by the cat, showing that the mouse lost.

The cheese:

How the programme starts:


When the green flag is pressed, the cheese is shown and appears at that location.

How its caught by the mouse:


When the mouse touches the cheese, it disappears and sends that broadcast named: cheese. When its sent, the bowl appears down on the right corner of the game

More scripts:


We explained the function of these both broadcast. The first one is when the cheese should appear in the bowl, and the second one is just for it to hide when the cat eats the mouse.

The Bowl:

How the programme starts:


When the green flag is pressed, the Bowl hides. It doesn't appear at any specifical location because it doesn't move.

How it's shown:


The mouse "leaves" the cheese on the bowl. When the cheese and the bowl are touching them, the backdrop switches to "You won, Click on the green flag to play again!", the bowl hides and sends the broadcast hide. This means that every sprite who receives this broadcast should hide.



Last scripts:


When the bowl receives a broadcast with the name "lost" it should hide. It must do the opposite when the broadcast with the name "cheese" is sent.


Here a collage of our game:



And to finish, a World-Cloud based on this project:

                             

Lucia Kulzer and Pia Palacios



No comments:

Post a Comment