Hey guys I’m making a tetris game and right now I wanna test a fuction that checks to see if the piece has collided with the wall. Except it says my collision function is not defined?
That would be this section of code:
//create an array to hold all of the tetrominos const pieces = [ [Z, 'red'], [S, 'limegreen'], [T, 'yellow'], [O, 'blue'], [L, '#b938ff'], [I, 'cyan'], [J, 'orange'] ]
The console is right, for Z, S, T, and so forth aren’t defined anywhere.
My bad I actually have them defined in the tetromino.js file I just don’t have it on the fiddle, since I can onlyu put one js file there. I forgot this would create a problem rendering the actual tetromino pieces to the board. Here, I moved the all the tetromino arrays to the tetris.js file so you can now see the main issue I’m having https://jsfiddle.net/6nsjktgm/1/
Compare your code with the code in the GitHub repo, and you’ll easily find the reason why.