Open DreamyK9 opened 2 years ago
I fixed the Nan
Error by simply initializing prev
with value 0 in sketch.js.
I noticed a few things that have to be modified in order to make the modularization work.
First of all, is that even needed? I mean we are not dealing with multiple p5 sketches simultaneously, so why...
The p5 Instance is handed weirdly around the JS files, I would suggest looking at "GoToLoop" answering here: https://discourse.processing.org/t/p5js-instance-mode-how-to-manage-functions/25369
Then this.p5.whatever
will be just p.whatever
Then there are some issues with importing. For Example the InputManager.js had issues with pausing the Game, which i fixed just now by importing togglePause()
from Piece.js and cleaned it up.
Lastly, the game stills draws no Pieces. The reason for that lies in Grid.js (i suppose). I noticed that drawing works and the game progresses but the pieces are just invisible out of some reason....
I tried turning the project structure into modules, which I was mostly successful with, but afterwards at least one nasty bug showed up. The pieces no longer spawn on the grid, and therefore the game overall doesn't progress.
It seems to have to do with
activePiece.dropBuffer
not updating and instead beingNaN
. Though I have no idea why.I committed it to a new branch called modularize for now.