Your first game
Practical case: Let's create our first game!
With all this we can create a simple game.
- At the beginning of the game, just the cat appears
inon a Stage of your choice, asks your name, greets you and invites you to play. - Next the dog appears.
- We will move the cat with the arrows of the keyboard. As the cat moves, it changes of costume simulating it walks.
- When the cat touches the dog, the dog moves to a random place and barks.
Solution
Identify
Inin athis previous activity we have seen thatprogram the "If...then"following blockelements:
- Inputs:
- Outputs:
- Storage:
times after pressing each key.This solution shows how to put these blocks just once in a separate program within Cat programming.It is necessary to add the "forever" block so thatif it isconstantlynecessary - Operators:
Cat program:
Dog code: