kittykatattack / learningPixi

A step-by-step introduction to making games and interactive media with the Pixi.js rendering engine.
4.4k stars 851 forks source link

Fix keyboard function #106

Closed drskullster closed 5 years ago

drskullster commented 6 years ago

Move event.preventDefault() calls inside the condition that checks if the key pressed is the one we want. Current implementation prevents normal use of keyboard like reloading the page.

Add a unsubscribe() method to remove event listeners. I can't see any way to remove them in current implementation, and this is a crucial feature.