===================================================================
--- original.js
+++ change.js
@@ -91,8 +91,13 @@
}, 1000);
// Handle game updates
game.update = function () {
// Update hero
+ if (LK.isTouching) {
+ var touchPos = game.toLocal(LK.touch.global);
+ hero.x += (touchPos.x - hero.x) * 0.1;
+ hero.y += (touchPos.y - hero.y) * 0.1;
+ }
hero.update();
// Update enemies
for (var i = enemies.length - 1; i >= 0; i--) {
enemies[i].update();
@@ -118,7 +123,7 @@
};
// Handle touch events for shooting
game.down = function (x, y, obj) {
hero.shoot();
- hero.x = x;
- hero.y = y;
+ // hero.x = x;
+ // hero.y = y;
};
\ No newline at end of file