Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

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);
},

1 decade ago by dominic

Your code looks ok.

Which version of Impact are you using?

Are you building this on top of one of the demo games? Check your main.js - you may still have some code in there that tries to moves the screen as well.
Page 1 of 1
« first « previous next › last »