In this multi-part coding challenge, I code the sliding puzzle game 2048 in JavaScript using canvas and p5.js. Code: thecodingtrain.com/challenges...
🕹️ p5.js Web Editor Sketch: editor.p5js.org/codingtrain/s...
Other Parts of this Challenge:
📺 2048 - Part 2: • Coding Challenge #94: ...
📺 2048 - Part 3: • Coding Challenge #94: ...
📺 2048 - Part 4: • Coding Challenge #94: ...
🎥 Previous video: • Coding Challenge #93: ...
🎥 Next video: • Coding Challenge 95: A...
🎥 All videos: • Coding Challenges
References:
💾 2048: gabrielecirulli.github.io/2048/
🌐 2048 on Wikipedia: en.wikipedia.org/wiki/2048_(v...)
Videos:
🔴 Coding Train Live 122 • Coding Train Live 122:...
Related Coding Challenges:
🚂 #142 Rubik's Cube: • Coding Challenge #142:...
🚂 #149 Tic Tac Toe: • Tic Tac Toe in p5.js (...
🚂 #165 Slide Puzzle: • Coding Challenge 165: ...
Timestamps:
0:00 Introducing today's topic: 2048 sliding puzzle game
2:50 How does the game work?
5:16 Let's Code!
6:10 Write an addNumber function
8:12 Use the ternary operator to pick either a 2 or 4
9:54 Draw the board
14:38 Write a slide function
18:10 Add a keyPressed function to slide the numbers
19:13 Write a combine function
25:23 Write an operate function
31:29 Check to see if a number has moved
33:09 Write a function to compare two different matrices
34:50 Conclusion and next steps
Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound
🚂 Website: thecodingtrain.com/
👾 Share Your Creation! thecodingtrain.com/guides/pas...
🚩 Suggest Topics: github.com/CodingTrain/Sugges...
💡 GitHub: github.com/CodingTrain
💬 Discord: thecodingtrain.com/discord
💖 Membership: kzitem.infojoin
🛒 Store: standard.tv/codingtrain
🖋️ Twitter: / thecodingtrain
📸 Instagram: / the.coding.train
🎥 Coding Challenges: • Coding Challenges
🎥 Intro to Programming: • Start learning here!
🔗 p5.js: p5js.org
🔗 p5.js Web Editor: editor.p5js.org/
🔗 Processing: processing.org
📄 Code of Conduct: github.com/CodingTrain/Code-o...
This description was auto-generated. If you see a problem, please open an issue: github.com/CodingTrain/thecod...
#2048 #slidingpuzzlegame #javascript #p5js
Негізгі бет Coding Challenge #94: 2048 - Part 1
Пікірлер: 202