Create a 2D Breakout Game Using JavaScript and HTML | PART 1 | JavaScript Project For Beginners

Опубликовано: 02 Апрель 2019
на канале: Code Explained
38,926
854

Code Explained Says Hi.

Welcome to another tutorial, where we're going to create a game called "2D Breakout" using JavaScript and HTML 5, the tutorial is created especially for beginners in JavaScript. We will discuss the logic behind every line of code, And try to break down things as much as we can. and after that, we will open our text editors and start typing the code.

In the 2D Breakout game, you need to break all the bricks using a bouncing ball, a ball that you need to prevent from leaving the game area using the paddle.

This tutorial will be long, that's why I chose to split it into two parts.

In the first part, we will be able, to draw the paddle and the ball, we will be able to control the paddle using the left and the right arrows on the keyboard, we will make the ball moves, and we will also implement the collision detection logic, so when the ball hits a wall it must change the direction.

When the ball hit the paddle, the ball should go in a definite direction based on where the ball hit the paddle so the paddle won't act like a wall. which means you can determine where the ball goes when you hit it with the paddle.

In the second part, we will implement the bricks in the game, add a collision detection function, when the ball hit a brick, the brick must disappear and then increment the player's score.

The player has 3 lives, when he loses a life, we reset the ball position and give him a chance to continue playing, when he loses all the 3 lives, it's a game over, we show him a game over message, and a "play again" button to play over.

To win the game, the player has to break all the bricks on each level, and he has to complete 7 levels, when he passes from a level to another, the number of bricks increases and also the speed of the ball.

We will also implement some sounds in the game, and we will create a button for when you want to turn ON/OFF the sounds.

If you want to follow along with me when I type in the code, you'll need to download the starter template from GitHub.
-----------------------------------------------------------------------------------------------------
| LINKS |
-----------------------------------------------------------------------------------------------------

DOWNLOAD SOURCE CODE + STARTER TEMPLATE:
https://www.codeexplained.org/2020/06...

🌍 Social Media Links.
◾ Facebook :   / code.explained.official  
◾ Twitter :   / code_explained  
◾ Instagram :   / code.explained.official  
◾ GitHub : https://github.com/CodeExplainedRepo

💲 Suppport the Channel
Paypal : https://paypal.me/CodeExplained
Buy Me a Coffee: https://www.buymeacoffee.com/CodeExpl...

--------------------------------------------------------------------------------
| HASH TAGS |
--------------------------------------------------------------------------------
#javascript #2dbreakout #beginners #tutorial #game


Смотрите видео Create a 2D Breakout Game Using JavaScript and HTML | PART 1 | JavaScript Project For Beginners онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Code Explained 02 Апрель 2019, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 38,926 раз и оно понравилось 854 людям.