Code edit (1 edits merged)
Please save this source code
User prompt
dont make the color random, choose randomly from these colors: gold, blue, purple, yellow, red,
User prompt
dont make the color random, choose randomly from these colors: gold, blue, purple, yellow, red,
User prompt
remove the random firework color, and make it be selectable
User prompt
Fix Bug: 'ReferenceError: randomColor is not defined' in this line: 'particle.color = randomColor; // Assign random color to particle' Line Number: 79
User prompt
make a firework selector
User prompt
move the trail with a speed of 13
User prompt
remove callback
User prompt
Fix Bug: 'TypeError: callback is not a function' in this line: 'callback();' Line Number: 13
User prompt
dont explode the firework until the trail has reached the position of the mouse click
User prompt
spawn the trail at the x of the mouse click
User prompt
the fireworks should only explode when the trail reached its destination.
User prompt
make an launchtrail object, it spawns at the middle bottom of the screen.
User prompt
the trail should move up gradually with a speed of 3
User prompt
move it gradually witha speed of 3
User prompt
spawn the launchtrail at the bottom of the screen, move the launchtrail to the y position of the mouse click (where the firework is)
User prompt
move the launchtrail to the y position of the mouse click (where the firework is)
User prompt
after spawn, move the launchtrail up (down) to the y level of the mouse click
User prompt
spawn the launchtrail at mouse down, at the bottom of the screen
User prompt
the launchtrail should spawn at the bottom of the screen on mouse down, use the x of the mouse
User prompt
Ensuring that the trail moves upwards by decreasing its y-coordinate (since the top of the screen has a y-coordinate of 0).
User prompt
move the launchtrail up to the y level of the mouse click, with a speed of 20
User prompt
spawn the launchtrail on mouse down, at the bottom of the screen. move it to the y of the mouseclick and it should already spawn at the x of the mouse
User prompt
make a launchtrail object, dont add any logic
User prompt
the launchtrail should use a launchtrail object
===================================================================
--- original.js
+++ change.js
@@ -46,9 +46,9 @@
var Firework = Container.expand(function () {
var self = Container.call(this);
self.particles = [];
self.explode = function (x, y) {
- var colors = [0xFFD700, 0x0000FF, 0x800080, 0xFFFF00, 0xFF0000];
+ var colors = [0xFFD700, 0x0000FF, 0x800080, 0xFF00FF, 0xFF0000];
var randomColor = colors[Math.floor(Math.random() * colors.length)];
for (var i = 0; i < 50; i++) {
var particle = new FireworkParticle();
var angle = Math.random() * Math.PI * 2;