Skip to content

A clone of the classic “2048” game, developed using JavaScript, HTML and CSS. It was inspired by Ania Kubow.

License

Notifications You must be signed in to change notification settings

techgirldiaries/MagicTiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

2048 JavaScript Game

2048, the very popular game in Vanilla JS, HTML and CSS.

Rules of 2048

2048 is played on a 4×4 grid, with numbered tiles that slide smoothly when a player moves them using the four arrow keys. Each time you slide, a new tile will randomly appear in an empty spot on the board. Tiles slide as far as possible in the chosen direction until they are stopped by either another tile or the edge of the grid. If two tiles of the same number collide while moving, they will merge into a tile with the total value of the two tiles that collided. The resulting tile cannot merge with another tile again in the same move.

Software I used in this tutorial

By creating this popular game we will learn the following javaScript Methods

  • querySelector()
  • getElementById()
  • createElement()
  • appendChild()
  • push()
  • Math.floor()
  • Math.random()
  • length
  • innerHTML
  • parseInt()
  • filter()
  • Array()
  • fill()
  • concat()
  • keyCode
  • addEventListener()
  • removeEventListener()
  • setTimeout()
  • clearInterval()
  • setInterval()

If you did like this project, please do Like and Follow so I know to make others like this!

A heartful thanks to Ania Kubow for inspiring me to create this game.

I would love to see what you have made so please share your finished games with me on Twitter! My handle is @techgirldiaries.

MIT Licence

Copyright (c) 2024 Oluwakemi Toluwalase

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

*Translation: Definitely, you can use this for you project! Just make sure to say where you got this from.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

A clone of the classic “2048” game, developed using JavaScript, HTML and CSS. It was inspired by Ania Kubow.

Topics

Resources

License

Stars

Watchers

Forks