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
@@ -24,8 +24,9 @@
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 2;
+ self.hitPoints = Math.floor(Math.random() * 3) + 1; // Random hit points between 1 and 3
self.update = function () {
self.y += self.speed;
};
});
@@ -98,12 +99,15 @@
var piggy = piggies[j];
if (bullet.intersects(piggy)) {
bullet.destroy();
bullets.splice(i, 1);
- piggy.destroy();
- piggies.splice(j, 1);
- LK.setScore(LK.getScore() + 1);
- scoreTxt.setText(LK.getScore());
+ piggy.hitPoints--;
+ if (piggy.hitPoints <= 0) {
+ piggy.destroy();
+ piggies.splice(j, 1);
+ LK.setScore(LK.getScore() + 1);
+ scoreTxt.setText(LK.getScore());
+ }
break;
}
}
}