Closed asg5704-deprecated closed 6 years ago
Does the same thing happen when you use the actual code for the chapter—http://eloquentjavascript.net/3rd_edition/code/chapter/16_game.js along with http://eloquentjavascript.net/3rd_edition/code/game_levels.js ?
No it does not. The runGame function did not have a fallback to use the simpleLevelPlan when not using game_levels.js.
Since runGame
takes an array of level plans, you can pass it [simpleLevelPlan]
to run only that level (but it wouldn't be a very interesting game).
Description: Ran into issue while trying to create A Platform Game (Chapter 16) of Eloquent Javascript, 3rd Edition. TypeError in the State.prototype.update function.
Expected Behavior The platform game would be drawn to the DOM, the game would be able to be played.
Actual Behavior Issue: Uncaught TypeError: Cannot read property 'pos' of undefined pointing towards the State.prototype.update function.
Additional Information I typed it out the first time while reading through the book. The second time I copied all the code from the sandbox just in case I made a mistake typing it. Included is a screenshot as well as the .zip of the js/html/css
ch16.zip