Cómo hacer SNAKE en Scratch 🐍 | Juego de la serpiente - Tutorial Scratch 3.0 en español

Cómo hacer SNAKE en Scratch 🐍 | Juego de la serpiente - Tutorial Scratch 3.0 en español

New Section

In this section, the speaker introduces the tutorial on programming the game "Snake" in Scratch, a popular game from the 90s and 2000s. The tutorial aims to recreate this viral game using Scratch programming.

Introduction to Snake Game Programming

  • The initial step involves creating a new object resembling a circle with two black eyes pointing right to represent the snake.
  • Setting up the snake's initial position and direction, allowing control using arrow keys for movement.
  • Enabling directional control by coding arrow key presses to change the snake's direction accordingly.
  • Implementing a trail behind the snake by creating clones that persist on-screen for a duration as it moves.
  • Managing the length of the trail left by the snake as it progresses, adjusting timing for clone removal based on its growth.

Configuring Food and Growth Mechanism

This part focuses on setting up food items like apples and bananas in random positions while ensuring they do not overlap with the snake. Additionally, it covers mechanisms for scoring points and increasing snake length upon consuming food.

Food Setup and Growth Mechanism

  • Introducing food objects such as apples and bananas within Scratch costumes for variety.
  • Randomizing food placement to prevent overlap with the snake's position, ensuring fair gameplay mechanics.
  • Implementing waiting periods after food consumption before reappearing, enhancing gameplay dynamics.
  • Incorporating visual changes in food items upon consumption through costume switching for interactive feedback.
  • Establishing point systems tied to food consumption, tracking scores visibly while managing snake length discreetly.

New Section

In this section, the speaker discusses the mechanics of the game related to snake length and points accumulation.

Snake Length and Points Mechanism

  • The initial snake length is set to 0.5, increasing by 0.2 for each point earned.
  • Eating food extends the snake, making it longer over time.
  • If the snake hits a wall, the game stops; a message indicating game over can be displayed.
  • The original game had limitations on self-interaction; adjustments are needed to mimic this behavior.

New Section

This part focuses on enhancing gameplay similarity to the original version by introducing a tail mechanic.

Introducing Tail Mechanics

  • Setting a minimum snake length of 0.5 without displaying it directly.
  • Creating a separate object for the tail that can cause loss if touched.
  • Ensuring the tail follows behind the main snake continuously.

New Section

Here, details about managing and displaying the tail in relation to snake movement are discussed.

Managing Tail Movement

  • The tail appears after a delay and aligns with the end of the main snake segment.
  • Configuring initial length values for both snake and tail components.

New Section

This section covers collision detection mechanisms within the game environment.

Collision Detection Implementation

  • Adjusting conditions for losing based on touching borders or own tail.
  • Implementing logic to detect collisions with boundaries or self-intersection.

New Section

Addressing timing issues related to game initialization and component visibility.

Timing Adjustments for Game Start

  • Delaying tail appearance at game start to prevent immediate collisions.
Video description

En este vídeo, explicamos cómo crear y programar el clásico juego Snake en Scratch 3.0. 🔗 ENLACE AL PROYECTO: https://scratch.mit.edu/projects/545108111/ Daily Beetle by Kevin MacLeod is licensed under a Creative Commons Attribution license (https://creativecommons.org/licenses/by/4.0/) Source: http://incompetech.com/music/royalty-free/index.html?isrc=USUAN1500025 Artist: http://incompetech.com/ Perfil de Scratch: https://scratch.mit.edu/users/diegomapo/ Perfil de Twitter: https://twitter.com/primaria_el Contacto: elrincondeprimaria2020@gmail.com