User prompt
generation an animated explosion of particles when an arrow hits the target
User prompt
reduce distance particles travel
User prompt
why aren't the particles moving????
User prompt
make the the particles travel at least 400 pixels away from target in a random direction
User prompt
the particles aren't moving anywhere, fix it. This should be an explosion of particles
User prompt
increase distance that particles travel away from target
User prompt
make the firework particles move away from starting position at a random angle when target is hit
User prompt
when arrow hits target generate 10 firework assets and have them explode away from the position where arrow hit target
User prompt
move arrow counter to centre top of screen
User prompt
remove firework when it has been onscreen for 1 second
User prompt
fade the firework progressively from alpha=1 to alpha=0 over .5 secs after it has been added then remove
User prompt
make firework fade out to alpha=0 after .5 secs
User prompt
make firework fade out after .5 secs
User prompt
firework should fade out over time and remove when alpha=0
User prompt
initial x and y of firework should be where the arrow hit the target
User prompt
do not add a new firework if arrow misses target
User prompt
when target is hit, display firework at same x and y position of target
User prompt
add firework image
User prompt
create a new graphic asset called firework
User prompt
offset archer asset down by 10 pixels
User prompt
offset archer asset down by 50 pixels
User prompt
add background image
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'y')' in this line: 'scoreTxt.y = arrowCountTxt.y;' Line Number: 44
User prompt
reduce size of score text so the same as arrow count text and align on same y
User prompt
add the word "Score:" next to the score
===================================================================
--- original.js
+++ change.js
@@ -1,16 +1,12 @@
-var FireworkParticle = Container.expand(function () {
+var Particle = Container.expand(function () {
var self = Container.call(this);
- var particleGraphics = self.createAsset('fireworkParticle', 'Firework Particle Graphics', .5, .5);
- self.speed = Math.random() * 20 + 20;
+ var particleGraphics = self.createAsset('particle', 'Particle Graphics', .5, .5);
+ self.speed = Math.random() * 5 + 2;
self.direction = Math.random() * Math.PI * 2;
self.move = function () {
self.x += Math.cos(self.direction) * self.speed;
self.y += Math.sin(self.direction) * self.speed;
- self.speed *= 0.95;
- if (self.speed < 0.1) {
- self.destroy();
- }
self.alpha -= 0.01;
if (self.alpha <= 0) {
self.destroy();
}
@@ -18,16 +14,8 @@
});
var Firework = Container.expand(function () {
var self = Container.call(this);
var fireworkGraphics = self.createAsset('firework', 'Firework Graphics', .5, .5);
- for (var i = 0; i < 10; i++) {
- var particle = self.addChild(new FireworkParticle());
- particle.x = 0;
- particle.y = 0;
- LK.on('tick', function () {
- particle.move();
- });
- }
LK.setTimeout(function () {
self.destroy();
}, 1000);
});
@@ -129,11 +117,14 @@
target.scale.y *= 0.9;
}
target.speed *= 1.05;
target.x = Math.random() * (2048 * 0.2) + 2048 * 0.7;
- var firework = self.addChild(new Firework());
- firework.x = arrows[a].x;
- firework.y = arrows[a].y;
+ for (var i = 0; i < 100; i++) {
+ var particle = new Particle();
+ particle.x = arrows[a].x;
+ particle.y = arrows[a].y;
+ self.addChild(particle);
+ }
arrows[a].destroy();
arrows.splice(a, 1);
player.y = Math.random() * (2732 / 2 + 300 - (2732 / 2 - 300)) + 2732 / 2 - 300;
}
a green field background
a target roundel viewed from the side
plain gold star, no outline Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a cartoon archers bow viewed from the side Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a long cartoon arrow with gold shaft and steel point Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.