Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Map() {
- this.move = function(direction) {
- console.log("moving");
- }
- }
- function Game() {
- this.map = new Map();
- this.handleKeys = function(event) {
- var code = event.keyCode;
- if(code== 38)
- this.map.move("up");
- }
- }
- var game = new Game();
- document.onkeyup = game.handleKeys;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement