MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / createBoard

Function createBoard

assets/js/Pacman.js:46–63  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44
45 //create your board
46 function createBoard() {
47 for (let i = 0; i < layout.length; i++) {
48 const square = document.createElement('div')
49 grid.appendChild(square)
50 squares.push(square)
51
52 //add layout to the board
53 if(layout[i] === 0) {
54 squares[i].classList.add('pac-dot')
55 } else if (layout[i] === 1) {
56 squares[i].classList.add('wall')
57 } else if (layout[i] === 2) {
58 squares[i].classList.add('ghost-lair')
59 } else if (layout[i] === 3) {
60 squares[i].classList.add('power-pellet')
61 }
62 }
63 }
64 createBoard()
65
66

Callers 1

Pacman.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected