Code edit (1 edits merged)
Please save this source code
Code edit (8 edits merged)
Please save this source code
User prompt
please write that function as a standalone function to be called from within the star's current move function
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (22 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: center is not defined' in or related to this line: 'var instructionsTxt = new Text2('Welcome to space, traveler!\nTap to collect the color indicated below.', {' Line Number: 426
Code edit (1 edits merged)
Please save this source code
Code edit (12 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Error: The supplied index is out of bounds' in or related to this line: 'game.setChildIndex(counter, game.children.length);' Line Number: 249
Code edit (9 edits merged)
Please save this source code
User prompt
can you update this line, so it updates the textlabel with the new value
Code edit (1 edits merged)
Please save this source code
Code edit (18 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: sel is not defined' in or related to this line: 'self.x = sel.x;' Line Number: 24
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: particleGraphics is not defined' in or related to this line: 'if (particleGraphics.alpha <= 0) {' Line Number: 247
Code edit (1 edits merged)
Please save this source code
Code edit (5 edits merged)
Please save this source code
User prompt
please implement it that way
Code edit (5 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: movetype is not defined' in or related to this line: 'if (movetype == 0) {' Line Number: 119
===================================================================
--- original.js
+++ change.js
@@ -19,12 +19,9 @@
self.move = function () {
self.x += self.vx;
self.y += self.vy;
// Gradually fade out the particle
- particleGraphics.alpha -= 0.02;
- if (particleGraphics.alpha <= 0) {
- self.destroy();
- }
+ particleGraphics.alpha -= 0.002;
};
});
/*
TODOS:
@@ -220,15 +217,18 @@
****/
// Function to create radial particle explosion
function createRadialExplosion(x, y) {
var numParticles = 20;
- var particles = [];
+ //var particles = [];
for (var i = 0; i < numParticles; i++) {
- var angle = Math.random() * Math.PI * 2;
- var speed = Math.random() * 5 + 2; // Random speed between 2 and 7
+ //var angle = Math.random() * Math.PI * 2;
+ var angle = Math.PI * 2 / numParticles - i;
+ //var speed = Math.random() * 5 + 2; // Random speed between 2 and 7
+ var speed = 20;
var vx = Math.cos(angle) * speed;
var vy = Math.sin(angle) * speed;
- var scale = Math.random() * 0.5 + 0.5; // Random scale between 0.5 and 1
+ //var scale = Math.random() * 0.5 + 0.5; // Random scale between 0.5 and 1
+ var scale = 3;
var particle = new Particle();
particle.init(x, y, vx, vy, scale);
game.addChild(particle);
particles.push(particle);
@@ -237,8 +237,9 @@
LK.on('tick', function () {
particles.forEach(function (particle, index) {
particle.move();
if (particleGraphics.alpha <= 0) {
+ particle.destroy();
particles.splice(index, 1);
}
});
});
@@ -382,8 +383,16 @@
LK.gui.top.addChild(scoreTxt);
// Drag character
// Game tick
LK.on('tick', function () {
+ console.log(particles.length);
stars.forEach(function (star, index) {
star.move();
});
+ particles.forEach(function (particle, index) {
+ particle.move();
+ if (particle.getChildAt(0).alpha <= 0) {
+ particles.splice(index, 1);
+ particle.destroy();
+ }
+ });
});
\ No newline at end of file
A white triangle pointing down.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A colorful rectangular button with the text "Play Again" with each letter in a different color picked from a nice palette.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.