How to Make a Catch Game in Scratch | Tutorial

Scratch Team
26 Jan 202106:34

Summary

TLDREn este video, Zoë de Scratch Team, también conocida como Zinnea, presenta cómo crear un juego de atrapar objetos en Scratch. El juego consiste en que objetos caen desde el cielo y el jugador obtiene puntos al cogerlos. Se divide en cinco pasos: mover el atrapador, hacer que el objeto suba a la parte superior, caer, atraparlo y mantener la puntuación. Seguidamente, se elige un personaje o objeto para atrapar, se le permite moverse con las teclas de flecha, se agrega un fondo y se programan los movimientos laterales. Se elige un objeto para caer, como una manzana, y se le asigna una posición aleatoria en la parte superior de la pantalla. Luego, se programa para que caiga continuamente y, al tocar el fondo, regrese a la parte superior. Se añade la interacción de que, si la manzana toca el tazón (el atrapador), se detiene y vuelve a la parte superior, y se incluye un sonido de confirmación. Finalmente, se implementa un sistema de puntuación que aumenta cada vez que se atrapa una manzana. Zoë alentó a los espectadores a crear sus propios juegos de este estilo, sugiriendo diferentes escenarios y objetos para capturar, y terminó el video con ánimo positivo.

Takeaways

  • 🕹️ Para crear un juego de atrapar objetos en Scratch, se divide el proceso en cinco pasos: mover al atracador, hacer que el objeto suba, caer, ser atrapado y mantener la puntuación.
  • 🎮 Selecciona el personaje o objeto que atrapará cosas y haz que se mueva con las teclas de flecha.
  • 🏃 Utiliza el bloque 'cambiar X por 10' para mover al atracador horizontalmente, y un bucle 'siempre' para que la comprobación sea continua.
  • 🍎 Elige el objeto que caerá y asegúrate de que comience en una posición aleatoria en la parte superior de la pantalla.
  • 🔽 Para hacer que el objeto caiga, utiliza un número negativo en el bloque 'cambiar Y por' y coloca esto dentro de un bucle 'siempre'.
  • 🔁 Si el objeto toca el suelo, utiliza un bloque 'si entonces' para que regrese a la parte superior de la pantalla.
  • 🍎 Para simular la captura, usa un bloque 'si toca' para detectar si el objeto está en contacto con el atracador y, en ese caso, devuelve el objeto a la parte superior.
  • 🎵 Añade un sonido cuando el objeto es atrapado para mejorar la experiencia del juego.
  • 📊 Crea una variable llamada 'Puntuación' para seguir el rastro de la cantidad de puntos que el jugador ha acumulado.
  • 🔢 Utiliza el bloque 'cambiar [variable] por 1' para aumentar la puntuación cada vez que el jugador atrape un objeto.
  • 🌟 Establece la puntuación en cero al comenzar el juego para asegurar que se reinicie.
  • 🌌 Puedes personalizar el juego cambiando los objetos que caen, el atracador, y el fondo para adaptarlo a diferentes temáticas.

Q & A

  • ¿Quién es Zoë y qué equipo representa?

    -Zoë es un miembro del equipo Scratch, también conocido como Zinnea.

  • ¿En qué consiste el juego que Zoë quiere enseñar a crear?

    -El juego es un juego de atrapar objetos que caen desde el cielo para anotar puntos.

  • ¿Cómo se divide el proceso de creación del juego?

    -El proceso se divide en cinco pasos: mover al atrapador, hacer que el objeto vaya a la parte superior, caer, atraparlo y mantener la puntuación.

  • ¿Cómo se selecciona el personaje o objeto que atrapará cosas en el juego?

    -Se hace clic en el botón 'Choose a Sprite' y se elige cualquier personaje o objeto deseado. Zoë elige una cuenco y también agrega un fondo, en este caso, una acera de la playa.

  • ¿Cómo se logra que el objeto (el cuenco) se mueva con las teclas de flecha?

    -Se utiliza el bloque 'change X by 10' para moverlo horizontalmente y se encierra dentro de un bucle 'forever' para que siempre esté revisando si las teclas de flecha están siendo presionadas.

  • ¿Cómo se hace para que el objeto (la manzana) caiga desde la parte superior de la pantalla?

    -Se utiliza el bloque 'go to random position' para que el objeto comience en una posición aleatoria y luego se establece su posición Y a 180 para que esté en la parte superior.

  • ¿Cómo se hace para que la manzana caiga continuamente y regrese a la parte superior cuando toca el fondo?

    -Se utiliza un bloque 'if then' para verificar si la posición Y de la manzana es menor que -170, lo cual indica que ha llegado al fondo. Si es así, se ejecuta el código para que la manzana regrese a la parte superior.

  • ¿Cómo se implementa la interacción para que el cuenco atrape la manzana?

    -Se utiliza un bloque 'if then' que verifica si la manzana está tocando el cuenco. Si es así, la manzana deja de caer y vuelve a la parte superior de la pantalla en una posición aleatoria.

  • ¿Cómo se agrega un sistema de puntuación al juego?

    -Se crea una variable llamada 'Score' y se utiliza el bloque 'change score by one' para aumentar la puntuación en uno cada vez que se atrapa una manzana. Además, se establece el score en cero al inicio del juego.

  • ¿Qué tipo de sonido se puede agregar cuando se atrapaba una manzana?

    -Se puede agregar un bloque de 'play sound' dentro del bucle 'forever' para reproducir un sonido cuando la manzana es atrapada.

  • ¿Por qué Zoë disfruta de los juegos de atrapar objetos?

    -Zoë disfruta de los juegos de atrapar objetos porque creen una amplia variedad de juegos basados en los objetos que caen, el personaje o objeto que los atrapa, y el fondo que se elige.

  • ¿Qué consejo final da Zoë para inspirar a los espectadores a crear sus propios juegos?

    -Zoë anima a los espectadores a explorar y crear sus propios juegos, sugiriendo que pueden ser de cualquier tipo, desde mantener un océano limpio atrapando basura hasta que un mascota recoja golosinas.

Outlines

00:00

🕹️ Creando un juego de atrapada en Scratch

Zoë de Scratch team, también conocida como Zinnea, presenta un tutorial para crear un juego de atrapada en Scratch. Este juego implica que objetos caen desde el cielo y el jugador los atrapa para anotar puntos. Se describen cinco pasos principales para construir el juego: mover al atrapador, hacer que el objeto suba a la parte superior de la pantalla, caer, atraparlo y mantener la puntuación. Se elige un personaje o objeto para atrapar, se le permite moverse con las teclas de flecha, se utiliza un bloque 'if then' para que el objeto se mueva horizontalmente en respuesta a las teclas de flecha derecha e izquierda. Además, se establece un bucle 'siempre que' para que el objeto siempre esté revisando si alguna tecla de flecha está siendo presionada.

05:00

🍎 Configurando el objeto caído y el juego de puntuación

Se selecciona el objeto que caerá, en este caso una manzana, y se programa para que comience en una posición aleatoria en la parte superior de la pantalla. Se utiliza un bucle 'siempre que' para que la manzana caiga continuamente y, cuando toque el fondo, regrese a la parte superior de la pantalla. Para evitar que la manzana caiga a través del atrapador, se implementa una condición que permite que la manzana se detenga y regrese a la parte superior si toca al atrapador. Se agrega un sonido de efecto cuando la manzana es atrapada. Finalmente, se introduce un sistema de puntuación que utiliza una variable para llevar un registro de la cantidad de puntos obtenidos por cada manzana atrapada. El puntaje se reinicia a cero al comenzar el juego.

Mindmap

Keywords

💡Scratch

Scratch es una plataforma de programación lúdrica y educativa diseñada para enseñar a los niños a programar. En el video, se utiliza para crear un juego de atrapar objetos que caen, representando el entorno de desarrollo central en el que se lleva a cabo la actividad.

💡Catch game

Un juego de atrapar es un tipo de juego en el que los jugadores deben recoger o 'atrapar' objetos que caen o se mueven por la pantalla. Este concepto es la base del tutorial, donde se enseña cómo crear este tipo de juego en Scratch.

💡Sprite

Un sprite en Scratch es un objeto gráfico que puede moverse o interactuar en la pantalla. En el video, tanto el objeto que cae como el que atrapa son sprites, y su programación y movimiento son fundamentales para el juego.

💡Backdrop

El backdrop es el fondo visual de un proyecto en Scratch. Se menciona en el script para establecer el ambiente de juego, como en el ejemplo donde se elige 'boardwalk' para establecer el escenario.

💡Code block

Los bloques de código son los elementos visuales que los usuarios de Scratch arrastran y colocan para programar el comportamiento de los sprites. En el tutorial, se utilizan bloques como 'change X by' y 'if then' para crear las acciones del juego.

💡If then block

El bloque 'if then' es una estructura de control de flujo que ejecuta un conjunto de instrucciones solo si una cierta condición es verdadera. En el video, se usa para hacer que el sprite se mueva y para detectar cuando el objeto es atrapado.

💡Forever loop

El bucle 'forever' es un bloque de código que permite que un conjunto de acciones se repita indefinidamente. En el contexto del juego, se usa para hacer que el objeto caiga continuamente y para que el sprite pueda moverse constantemente con las teclas de flecha.

💡Random position

Una posición aleatoria se refiere a la capacidad de los sprites en Scratch de aparecer en una ubicación indeterminada cada vez que se ejecuta un evento. Se utiliza en el juego para hacer que los objetos que caen comiencen en una ubicación impredecible.

💡Y position

La posición Y se refiere a la coordenada vertical de un sprite en Scratch, que indica qué tan alto o bajo está en la pantalla. Es crucial para el movimiento vertical de los objetos y para determinar si han llegado a la parte inferior de la pantalla.

💡Touching

En Scratch, 'touching' se refiere a la detección de colisión entre sprites. Se utiliza en el juego para saber si el objeto que cae ha sido 'atrapado' por el sprite del jugador, lo que desencadena una acción como hacer que el objeto vuelva a la parte superior de la pantalla.

💡Variable

Una variable es un contenedor para almacenar valores en un proyecto de Scratch. Se utiliza para rastrear información que cambia con el tiempo, como la puntuación en el juego. En el tutorial, se crea una variable llamada 'Score' para llevar puntuación de cuántos objetos han sido atrapados.

💡Green flag

El green flag es un bloque de código en Scratch que indica el inicio de la ejecución de un proyecto. Cuando se hace clic en él, todos los eventos y acciones programadas comienzan. En el video, se hace referencia a él como el momento en que el juego comienza.

Highlights

Zoë from the Scratch team introduces a tutorial on creating a catch game in Scratch.

The game involves objects falling from the sky to be caught for points.

Five steps are outlined for game creation: moving the catcher, object movement, falling, catching, and scoring.

Selection of a character or object to catch items, with movement controlled by arrow keys.

Use of the 'Choose a Sprite' button to select the catching character.

Adding a backdrop to the game for context, such as a boardwalk.

Utilization of the 'change X by 10' block for movement with arrow keys.

Explanation of the 'if then' block and its application in the game logic.

Implementation of a forever loop to continuously check for arrow key presses.

Choosing an object to fall, such as an apple, and setting its initial position at the top of the screen.

Using a random position block to start the falling object at a random location at the top.

Making the apple fall by changing its Y value in a forever loop.

Detecting when the apple has reached the bottom of the screen to reset its position.

Employing an if then block to check if the apple is at the bottom and reset its position.

Adding interactivity to catch the falling object with the bowl.

Using a 'touching' block to detect when the apple touches the bowl and trigger a catch.

Incorporating a sound effect to enhance the user experience upon catching the apple.

Introducing a scoring system with a variable to track the number of caught apples.

Setting the initial score to zero at the start of the game for a fair beginning.

Flexibility in creating various catch games by changing the falling objects, catcher, and backdrop.

Encouragement for users to explore creativity in making their own catch games.

Transcripts

play00:00

- Hi everyone, it's Zoë from the Scratch team,

play00:02

also known as Zinnea.

play00:03

Today I wanted to show you

play00:05

how to make a catch game in Scratch.

play00:07

A game where objects are falling from the sky

play00:09

and you catch them to score points.

play00:10

It could be any object that's falling,

play00:12

and it can be any character or object that's catching it.

play00:14

We'll break this into five steps.

play00:16

Move the catcher, make your object go to the top,

play00:20

fall down, catch it, and keep score.

play00:25

Let's get started.

play00:26

First, let's pick the character or object

play00:28

that you want to be catching things,

play00:30

and we're gonna make it move with the arrow keys.

play00:32

You can just click this button that says, Choose a Sprite,

play00:34

and you can pick anything you want.

play00:36

I'll use the bowl, and let's add a backdrop too.

play00:39

I'll use the boardwalk.

play00:41

So, we want the bowl to be able to move side to side

play00:44

with the arrow keys, so that it can catch

play00:46

whatever's gOnna be falling.

play00:47

We can use this block, change X by 10

play00:49

to make the ball go this way.

play00:51

Let's make the ball do this,

play00:53

if the right arrow key is pressed.

play00:55

There's a really helpful block for this,

play00:57

which is an if then block.

play00:58

In case you haven't seen an if then block before,

play01:00

here's how they work.

play01:01

I find that they're really easy to use.

play01:03

If then blocks will make a Sprite

play01:05

do the code that's in here,

play01:07

only if the thing that's in here is true.

play01:11

So in this example,

play01:12

if the cat is touching the mouse pointer

play01:14

it will play the sound, meow,

play01:16

but if it's not touching the mouse pointer,

play01:18

it won't play any sound.

play01:19

So in our game, if the right arrow key is pressed,

play01:24

we can make the bowl change X by 10.

play01:26

Let's try it out, and let's make it start

play01:28

when I click the green flag.

play01:30

So, I'm pressing the right arrow key

play01:32

but nothing is happening.

play01:34

That's because this if then block

play01:36

is only being checked once.

play01:37

When I click the green flag,

play01:39

it's asking, is the right arrow being pressed right now?

play01:42

But then it just stops doing the code.

play01:43

And what we want it to do, is always be checking

play01:47

if the right arrow key is pressed at any moment.

play01:49

So, we can just put this inside a forever loop.

play01:52

And now, now this is what we want.

play01:55

It's always checking, is the right arrow key being pressed?

play01:58

And to make the bowl go to the left,

play01:59

instead of changing X by 10, we can change X by -10.

play02:04

Let's make it do this, if the left arrow key is pressed.

play02:07

And let's put this in the forever loop too.

play02:10

There we go, now we have a catcher

play02:12

that we can move with the arrow keys.

play02:14

Next, let's pick the object that we want to be falling

play02:16

and make it go to the top of the screen.

play02:18

You can use any object you want.

play02:20

I'll use the apple.

play02:22

At the beginning of the game,

play02:23

We want the apple to start at a random place at the top.

play02:27

This block, go to random position,

play02:29

will make it go to a random place.

play02:31

And this block, set Y, can set how high up a Sprite is.

play02:36

In Scratch, Y represents how far a Sprite is

play02:39

from the bottom of the screen to the top of the screen.

play02:41

So if we set Y to zero,

play02:43

the apple goes up to about the middle.

play02:45

If we set Y at 20, it goes up a little higher,

play02:47

and 180 makes it go all the way to the top.

play02:50

Now, if we make the apple go to a random position

play02:52

and then set Y to 180, it goes to a random place

play02:55

but then Y is always set to be at the top,

play02:58

And that's just what we want.

play02:59

When the game starts,

play03:00

it starts at a random place at the top of the screen.

play03:02

Now, let's make our apple fall down.

play03:04

If we change, Y by 10, the apple goes upwards.

play03:08

To make it go down, we can put in a negative number.

play03:11

And if we put this inside a forever loop,

play03:13

it'll keep falling until it hits the bottom.

play03:15

But now it's stuck.

play03:16

So right now, we have an apple that can fall one time,

play03:19

what we would like it to do

play03:20

is if it's at the bottom, it goes to the top.

play03:23

This is another good time to use an if then block.

play03:25

So let's drag one out.

play03:27

In here, we need to put some code

play03:29

that checks if the apple is at the bottom.

play03:31

Now, how can we tell if the apple is at the bottom?

play03:34

Well, remember how I said

play03:35

that Y represents how high up a Sprite is,

play03:38

let's look at the apple's Y while it's falling.

play03:40

Its Y position starts at 180,

play03:43

then it goes to 170, 160, it gets to zero,

play03:46

then it goes to -10, -20.

play03:48

And then down here, it's like -170.

play03:50

So what we can test in here is,

play03:52

we can just check if the Y position of the apple

play03:54

is less than -170.

play03:56

'Cause if the apple's Y position is that low,

play03:59

then we know it must be at the bottom.

play04:01

So to test that, we can drag out this round blue block

play04:04

that says Y position, and drag out the green less than block

play04:08

from the operator's category.

play04:10

This block just checks if the thing on this side

play04:13

is less than the thing on this side.

play04:14

We want to check if Y is less than -170.

play04:17

So we can put Y on this side, and write -170.

play04:21

Now, if the apple is at the bottom,

play04:23

what do we want it to do?

play04:24

Well, we want it to go back up to the top,

play04:26

and we actually already have the code for that

play04:28

because we wrote it right here.

play04:29

So, let's just put a copy of that same code in here.

play04:32

And let's put this code inside our forever loop.

play04:35

So every time the apple moves down by -5,

play04:38

it asks, am I at the bottom?

play04:40

There we go.

play04:41

Now we have an apple that can fall,

play04:42

and when it gets to the bottom, it goes back up to the top.

play04:44

Now, let's make it so that we can actually catch the apples

play04:47

instead of them just falling through the bowl.

play04:49

If the apple touches the bowl, then the player caught it.

play04:52

So it should stop falling

play04:54

and go back to the top somewhere else

play04:56

so it can start falling again.

play04:57

So, this is another good time for an if then block.

play05:00

There's this helpful block that says,

play05:01

touching mouse-pointer,

play05:02

and instead of mouse-pointer, I can choose bowl.

play05:06

And now this block will test

play05:07

if the apple is touching the bowl.

play05:09

And if the apple is touching the bowl,

play05:11

we want it to go back to the top.

play05:13

And again, that's just our same code from before

play05:15

that makes it go to the top.

play05:17

Let's put this inside a forever loop,

play05:20

and let's make it play a sound when we catch it.

play05:22

Nice. Lastly, let's add a score

play05:25

so that you get points for every apple you catch.

play05:28

To make a score, We can add a variable.

play05:31

If you haven't seen this before,

play05:32

a variable lets you keep track

play05:34

of a certain number in your project.

play05:36

So, we can make a variable called Score

play05:39

and use it to keep track of how many points we've scored.

play05:42

We can use this change score by one block

play05:44

to make the score increase,

play05:46

and we can put this block here

play05:48

so every time we catch the apple,

play05:50

the score increases by one.

play05:52

And when the game starts, let's set the score to zero.

play05:56

So it resets, there we go.

play05:58

That's a catch game.

play05:59

Anyway, that's basically what I wanted to show you today.

play06:02

I love catch games 'cause I feel like they can be

play06:04

any type of game based on the objects that are falling

play06:07

and the character or the object that's catching them,

play06:09

and the backdrop you choose.

play06:11

You could be catching pieces of trash

play06:12

to keep an ocean clean,

play06:14

or a pet could be catching treats, or just really anything.

play06:18

I'm so excited to see all the things you make.

play06:20

Well, I'll see you next time, and Scratch on.

play06:23

(upbeat music)

Rate This

5.0 / 5 (0 votes)

Etiquetas Relacionadas
ScratchJuegoProgramaciónTutorialCódigoAtracciónPuntuaciónInteractivoEducativoCreatividadZoëZinneaSpriteFlechasFrutaPuntajeBucleCondicionalVariables