1 decade ago by yatayata
i want to be able to drag around the main map. can someone suggest ways to do this? code with problems below!
dragMap: function() {
var dx = ig.input.mouse.x - this.mouseLast.x; // always zero!
var dy = ig.input.mouse.y - this.mouseLast.y;
// this seems to get stomped on by games main loop
// it just snaps back during render
ig.game.screen.x -= dx;
ig.game.screen.y -= dy;
// cos all JS is a pointer, so need to use the ints directly..
this.mouseLast.x = ig.input.mouse.x;
this.mouseLast.y = ig.input.mouse.y;
glob = this.mouseLast;
// console.log("drag: " + dx + "," + dy);
},
