User prompt
make that the pig need to be touched more than 1 time randomly
User prompt
make the ship more realistic
User prompt
turn the ship
User prompt
Make the bullet go where i clic
User prompt
Please fix the bug: 'ReferenceError: x is not defined' in or related to this line: 'dragNode.x = x;' Line Number: 76
User prompt
Please fix the bug: 'ReferenceError: x is not defined' in or related to this line: 'dragNode.x = x;' Line Number: 73
User prompt
Please fix the bug: 'ReferenceError: dragNode is not defined' in or related to this line: 'if (dragNode) {' Line Number: 71
User prompt
make it move with the arrows
User prompt
make the spaceship move
User prompt
Please fix the bug: 'ReferenceError: dragNode is not defined' in or related to this line: 'if (dragNode) {' Line Number: 71
Initial prompt
Shooter
===================================================================
--- original.js
+++ change.js
@@ -9,9 +9,13 @@
anchorY: 0.5
});
self.speed = -10;
self.update = function () {
- self.y += self.speed;
+ var dx = this.targetX - this.x;
+ var dy = this.targetY - this.y;
+ var angle = Math.atan2(dy, dx);
+ this.x += Math.cos(angle) * this.speed;
+ this.y += Math.sin(angle) * this.speed;
};
});
// Piggy class
var Piggy = Container.expand(function () {
@@ -118,7 +122,9 @@
dragNode = null;
var bullet = new Bullet();
bullet.x = player.x;
bullet.y = player.y;
+ bullet.targetX = x;
+ bullet.targetY = y;
bullets.push(bullet);
game.addChild(bullet);
};
\ No newline at end of file