Code edit (2 edits merged)
Please save this source code
User prompt
move attachment of hero bullet to enemy 50 pixels up.
User prompt
move attachment of hero bullet to hero 50 pixels up
User prompt
hero bullet attached to enemy should move at the same speed and direction as enemy and remain attached to it.
User prompt
keep bullet attached to enemy no matter what
Code edit (1 edits merged)
Please save this source code
User prompt
add a flag to mark enemy as hit. if enemy has been hit, then bullets will not touch him anymore.
User prompt
when herobullet is attached to enemy. enemy should stop moving for a second and then double his speed.
Code edit (1 edits merged)
Please save this source code
User prompt
hero bullet should reamain attached to the enemy until enemy leaves the screen
User prompt
keep herobullet attached to enemy after hit
User prompt
add only 1 point the first time a hero bullet collides with an enemy
User prompt
move enemies 50 pixels down
User prompt
add 1 score per hero bullet attached to enemy
User prompt
when hero bullet is attached to enemy stop adding points to score
User prompt
Fix Bug: 'Timeout.tick error: Cannot read properties of undefined (reading 'speedX')' in this line: 'obstacles[i].speedX *= 1.2;' Line Number: 115
User prompt
when enemy is hit by a hero bullet, stop for half a second and then increase speed
User prompt
when hero bullet hits enemy, enemy will move faster
User prompt
when enemy is hit by hero bullet increase speed 3 times
User prompt
when enemy is hit by hero bullet increase its speed 10 times
User prompt
hero bullet only adds 1 point per enemy hit.
Code edit (1 edits merged)
Please save this source code
User prompt
when hero bullet is attached to enemy, move hero bullet 100 pixels higer.
User prompt
when hero bullet is attached to enemy, increase hero bullet asset size to 100 pixel
User prompt
when bullet hits enemy, attach the bullet asset on top of the enemy asset
===================================================================
--- original.js
+++ change.js
@@ -110,11 +110,13 @@
for (var j = hero.bullets.length - 1; j >= 0; j--) {
if (hero.bullets[j].intersects(obstacles[i])) {
if (obstacles[i] instanceof Enemy) {
obstacles[i].hitReactionTimer = 30;
- LK.setTimeout(function () {
- obstacles[i].speedX *= 1.2;
- }, 500);
+ LK.setTimeout((function (obstacle) {
+ return function () {
+ obstacle.speedX *= 1.2;
+ };
+ })(obstacles[i]), 500);
hero.bullets[j].destroy();
hero.bullets.splice(j, 1);
score++;
scoreTxt.setText(score);