Closed lemiesz closed 4 years ago
Ah i spoke to soon. You add the Math.sin() in the update method.
The simpleLevel plan can break if it is used in a editor that has autoformatting. In my case VSCode was adding additional spacing to some of the lines.
I'd say that's an (embarassing) bug in VSCode, and not something my code can help. Proper autoformatting (example) would know to leave template strings alone.
yah but also .trim()
would solve that issue.
I noticed a few bugs while going through the platformer tutorial Chatper 16. https://eloquentjavascript.net/16_game.html
1.) When creating the Coin class the use of Math.sin() is mentioned. However the create method omits this in its third paramter
return new Coin(basePos, basePos, Math.random() * Math.PI * 2);
2.) The simpleLevel plan can break if it is used in a editor that has autoformatting. In my case VSCode was adding additional spacing to some of the lines. I was able to fix this by trimming each row before mapping it.
let rows = plan.trim().split("\n").map(l => [...l.trim()]);