Advertisement
Guest User

this.map

a guest
Oct 20th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. function Map() {
  2. this.move = function(direction) {
  3. console.log("moving");
  4. }
  5. }
  6.  
  7. function Game() {
  8. this.map = new Map();
  9. this.handleKeys = function(event) {
  10. var code = event.keyCode;
  11. if(code== 38)
  12. this.map.move("up");
  13. }
  14. }
  15.  
  16. var game = new Game();
  17. document.onkeyup = game.handleKeys;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement