Skip to content
Browse files

disable keyboard scrolling on html

  • Loading branch information...
1 parent 50d2ef8 commit 2f48577cfecaaba4a84a992c171c14520cb53494 @severest severest committed Nov 24, 2012
Showing with 17 additions and 1 deletion.
  1. +2 −1 game.js
  2. +15 −0 index.html
View
3 game.js
@@ -16,6 +16,7 @@ window.onload = function () {
Crafty.sprite(20, 80, "imgs/bacon2.png", {firebacon:[0,0]});
Crafty.sprite(120, "imgs/burger_sheet.png", {burg:[0,0]});
Crafty.sprite(100,91, "imgs/egg_ss.png", {egg:[0,0]});
+ Crafty.sprite(100,91, "imgs/eggbullet.png", {eggbullet:[0,0]});
Crafty.sprite(120,107, "imgs/onion_ss.png", {onion:[0,0]});
Crafty.sprite(100, "imgs/fireball.png", {fireball:[0,0]});
Crafty.sprite(39,36, "imgs/peppermint.png", {peppermint:[0,0]});
@@ -32,7 +33,7 @@ window.onload = function () {
Crafty.load(["imgs/bullet.png","imgs/cloud1.png",
"imgs/forky_ss.png", "imgs/burger_sheet.png", "imgs/main_title.png","imgs/play_button.png", "imgs/play_button_on.png",
"imgs/fireball.png", "imgs/minifork.png", "imgs/bacon2.png", "imgs/peppermint.png",
- "imgs/onion_ss.png", "imgs/egg_ss.png", "imgs/sky_bg.png"], function () {
+ "imgs/onion_ss.png", "imgs/egg_ss.png", "imgs/eggbullet.png", "imgs/sky_bg.png"], function () {
Crafty.scene("title"); //when everything is loaded, run the main scene
});
View
15 index.html
@@ -47,6 +47,21 @@
color: #CCC;
}
</style>
+
+ <script>
+ var ar=new Array(33,34,35,36,37,38,39,40);
+
+ $(document).keydown(function(e) {
+ var key = e.which;
+ //console.log(key);
+ //if(key==35 || key == 36 || key == 37 || key == 39)
+ if($.inArray(key,ar) > -1) {
+ e.preventDefault();
+ return false;
+ }
+ return true;
+ });
+ </script>
</head>
<body>

0 comments on commit 2f48577

Please sign in to comment.
Something went wrong with that request. Please try again.