Code Memory Card Game in Javascript

preview_player
Показать описание
Make a memory card matching game with javascript html and css! In this tutorial, you will learn how to create a javascript match card memory game using Pokemon Energy Cards! You will learn how to randomly place cards onto the board and create click handlers for selecting two cards and checking if they match.

Java Game Programming Projects Playlist:

JavaScript Game Programming Projects Playlist:

Subscribe for more coding tutorials 😄!

var cardList = [
"darkness",
"double",
"fairy",
"fighting",
"fire",
"grass",
"lightning",
"metal",
"psychic",
"water"
]
Рекомендации по теме
Комментарии
Автор

Hello Kenny. I greatly appreciate this series, and I have been practicing game dev everyday this month, thanks to your work.

And I hope you make a tutorial on how to build Tetris! I have encountered difficult problems AFTER implementing rotation of pieces, and am curious how you would handle the pieces from the start.

shawnBuildsAI
Автор

Hey bro. Nice work. Keep it up!
I have a doubt, don't know if you're gonna be willing to answer it, if not, i understand. Without further ado

i wrote basically the same code as you until the minute 8:40 of the video, but in the console, when it prints the array "cardSet" two times, it's printing the array with the cards randomly disposed both of the times. Even with the first "console.log" being written before the shuffle structure (for). If i commentate the 'for' loop, it does show the array in the order that was supposed to.

here is the code (so there's no doubt, that is the same):

var errors = 0
var cardList = [
"darkness",
"double",
"fairy",
"fighting",
"fire",
"grass",
"lightning",
"metal",
"psychic",
"water"
]

var cardSet
var board = []

window.onload = function(){
shuffleCards()
startGame()
}

function shuffleCards(){
cardSet = cardList.concat(cardList)
console.log(cardSetl)

for(let i = 0; i < cardSet.length; i++){
let j = Math.floor(Math.random() *cardSet.length)

let temp = cardSet[i]
cardSet[i] = cardSet[j]
cardSet[j] = temp
}
console.log(cadSetl)
}

function startGame(){

}

vitorg.teixeira
Автор

hi, when you made the game you used the shuffling algorithm. where did you learn it? what book should I read to learn more about these algorithms? Or what video to watch?

useruser
Автор

Can you please code a text based space exploration game in html, css and script? I tried to generate the codes from Chatgpt4 and it did to same extent.

elitegamer