JavaScript Snake Game For Beginners | Logic Part | JavaScript Project

preview_player
Показать описание
🎁 Join my channel to get access to perks:

🧡 Hello All JavaScript Lovers Outhere!

In this tutorial, we're going to create the snake game we used to play on NOKIA mobile phones.

Snake is the common name for a video game concept where the player maneuvers a line which grows in length, with the line itself being a primary obstacle. The concept originated in the 1976 arcade game Blockade, and the ease of implementing Snake has led to hundreds of versions (some of which have the word snake or worm in the title) for many platforms. After a variant was preloaded on Nokia mobile phones in 1998, there was a resurgence of interest in the snake concept as it found a larger audience. There are over 300 Snake-like games for iOS alone.

The player controls a dot, square, or object on a bordered plane. As it moves forward, it leaves a trail behind, resembling a moving snake. In some games, the end of the trail is in a fixed position, so the snake continually gets longer as it moves. In another common scheme, the snake has a specific length, so there is a moving tail a fixed number of units away from the head. The player loses when the snake runs into the screen border, a trail or other obstacle, or itself.

And today you're going to create the Snake game using JavaScript and HTML(or HTML5).

We won't use any framework to build the game, just Vanilla JavaScript.

🕔 Timeline :
00:00:00 - Preview of the game
00:02:51 - Intro to JavaScript Game Development
00:17:42 - HTML5 Code
00:19:02 - Snake Game Components
00:20:16 - Game Loop
00:22:11 - Draw the board
00:24:29 - Draw a Square
00:30:04 - Create and Draw the Snake
00:33:16 - Move the Snake
00:39:41 - Fix Snake Movement : Moving into opposite direction.
00:41:12 - Fix Snake Movement : Fast turn
00:49:11 - Create and draw the food
00:56:51 - Check if Snake has Eaten the Food
00:59:19 - Collision Detection : Hit Wall and Hit Self
01:04:32 - Score
01:06:33 - High Score
01:10:39 - Show Game Over Screen
01:11:40 - Play Again The Game
01:12:57 - Outro

🌍 Social Media Links.

🤝 Suppport the Channel
Рекомендации по теме
Комментарии
Автор

🚨 Big Announcement! 🚨

Hey everyone! I've made a big decision for this channel—I've turned off ads on all my videos! That's right, you can now enjoy all my content ad-free! This means I'm earning $0 from ad revenue, but I believe this is the right move to make your viewing experience better.

If you find my content valuable and want to support my work, there are several ways you can help:

Like & Share: Simply liking the video and sharing it with friends helps a lot!
Subscribe & Hit the Bell: Stay updated and never miss a new video.
YouTube Thanks: Use the "Thanks" button below to send a one-time donation.
Join the Channel Community: Get exclusive perks and behind-the-scenes content.

Every little bit counts and goes directly to creating more high-quality content for you all. Thank you so much for your continued support!

Let’s keep growing and learning together! 🌟

CodeExplained
Автор

This was exactly what I was looking for

bhawishkumar
Автор

Thank's a lot for your detailed explanation! It is an exercise for logical thinking in Javascript!

hansschenker
Автор

Hello bro, can u help me about this game? How can assignment arrow symbol icon for move snake with javascript? That is good game but I want set arrow symbol icons on this game👍👍👍

mohammadmeraj
Автор

Sir Please Make Javascript Map project

codingislife