Permalink
Browse files

isometric: remove dependency on jQuery. Right click doesn't work on M…

…ac OS. change it to any click.
  • Loading branch information...
pengyu committed Jan 31, 2012
1 parent 97ff9e1 commit a9b3941cb2212e32072299a062baf39e24fd2507
Showing with 10 additions and 5 deletions.
  1. +7 −4 demos/isometric/game.js
  2. +3 −1 demos/isometric/isometric.htm
View
@@ -1,5 +1,5 @@
//pro tip: see also this work in progress by Hex http://jsfiddle.net/hexaust/HV4TX/
-$(document).ready(function() {
+window.onload = function() {
Crafty.init();
Crafty.sprite(128, "images/sprite.png", {
@@ -13,9 +13,12 @@ $(document).ready(function() {
for(var y = 0; y < 20; y++) {
var which = Crafty.math.randomInt(0,1);
var tile = Crafty.e("2D, DOM, "+ (!which ? "grass" : "stone") +", Mouse")
- .attr('z',i+1 * y+1).areaMap([64,0],[128,32],[128,96],[64,128],[0,96],[0,32]).bind("click", function(e) {
+ .attr('z',i+1 * y+1).areaMap([64,0],[128,32],[128,96],[64,128],[0,96],[0,32]).bind("Click", function(e) {
//destroy on right click
- if(e.button === 2) this.destroy();
+ //right click seems not work in Mac OS
+ //delete it
+ console.log(e.button);
+ /*if(e.button === 2)*/ this.destroy();
}).bind("MouseOver", function() {
if(this.has("grass")) {
this.sprite(0,1,1,1);
@@ -51,4 +54,4 @@ $(document).ready(function() {
Crafty.removeEvent(this, Crafty.stage.elem, "mousemove", scroll);
});
});
-});
+};
@@ -1,7 +1,9 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
+ <!--
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
+ -->
<script type="text/javascript" src="../../crafty.js"></script>
<script type="text/javascript" src="game.js"></script>
<title>Iso</title>
@@ -11,4 +13,4 @@
</head>
<body>
</body>
-</html>
+</html>

0 comments on commit a9b3941

Please sign in to comment.