Code edit (19 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: shopWindow is not defined' in or related to this line: 'shopWindow.hide();' Line Number: 341
Code edit (1 edits merged)
Please save this source code
Code edit (8 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'addChild')' in or related to this line: 'LK.gui.topleft.addChild(coinsTxt);' Line Number: 553
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (10 edits merged)
Please save this source code
User prompt
make a class for an upgrade button
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'length')' in or related to this line: 'var itemGraphic = self.attachAsset(id, {' Line Number: 215
Code edit (3 edits merged)
Please save this source code
User prompt
add a class for a shopitem
Code edit (1 edits merged)
Please save this source code
User prompt
add a background graphic object for the shopwindow.
User prompt
make a class for a shopwindow object
Code edit (12 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'move_temp')' in or related to this line: 'ufo.move_temp();' Line Number: 489
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 (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'STAR')' in or related to this line: 'self.type = enums.STAR;' Line Number: 189
===================================================================
--- original.js
+++ change.js
@@ -24,25 +24,14 @@
self.scaleUp = Math.random() < 0.5 ? true : false;
self.scale.x = 0.5 + Math.random() * 0.4;
self.scale.y = self.scale.x;
};
- //self.alpha = 1;
- /*
- self.move_not_really_migrated_but_still = function () {
- //self.x += 12;
- self.rotation += self.rotSpeed;
- self.x += windSpeedX + self.speed;
- self.y += windSpeedY + self.speed;
- };*/
});
var Astronaut = Container.expand(function () {
var self = Container.call(this);
var surfaceGraphics = self.attachAsset('athlete', {
anchorX: 0.5,
anchorY: 0.5,
- /*
- x: 1024,
- y: 818,*/
vely: 0
});
self._move_migrated = function () {
self.x += 12;
@@ -160,8 +149,56 @@
});
self.x = 1024; // Center horizontally
self.y = 2732 / 2; // Position at the center of the screen
});
+var RockParticle = Container.expand(function () {
+ var self = Container.call(this);
+ // Create a simple square shape for the particle
+ var particleGraphics = self.attachAsset('asteroidpowerup', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.width = 25 + Math.random() * 25;
+ self.height = self.width;
+ // Set initial speed and direction
+ self.speedX = Math.random() * 20 - 10;
+ self.speedY = Math.random() * 20 - 10;
+ // Set the particle to move and fade out over time
+ self._update_migrated = function () {
+ self.x += self.speedX;
+ self.y += self.speedY;
+ self.speedX *= 0.95; // Reduce speed for spreading effect
+ self.speedY *= 0.95; // Reduce speed for spreading effect
+ particleGraphics.alpha *= 0.95; // Increase alpha reduction for quicker disappearance
+ if (particleGraphics.alpha < 0.01) {
+ self.destroy();
+ }
+ };
+});
+var StarParticle = Container.expand(function () {
+ var self = Container.call(this);
+ // Create a simple square shape for the particle
+ var particleGraphics = self.attachAsset('starpowerup', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.width = 25 + Math.random() * 25;
+ self.height = self.width;
+ // Set initial speed and direction
+ self.speedX = Math.random() * 20 - 10;
+ self.speedY = Math.random() * 20 - 10;
+ // Set the particle to move and fade out over time
+ self._update_migrated = function () {
+ self.x += self.speedX;
+ self.y += self.speedY;
+ self.speedX *= 0.95; // Reduce speed for spreading effect
+ self.speedY *= 0.95; // Reduce speed for spreading effect
+ particleGraphics.alpha *= 0.95; // Increase alpha reduction for quicker disappearance
+ if (particleGraphics.alpha < 0.01) {
+ self.destroy();
+ }
+ };
+});
var StarPowerup = Container.expand(function () {
var self = Container.call(this);
var starGraphics = self.attachAsset('starpowerup', {
anchorX: 0.5,
@@ -228,8 +265,26 @@
game.addChild(particle);
particles.push(particle);
}
}
+function createStarExplosion(x, y, count) {
+ for (var i = 0; i < count; i++) {
+ var particle = new StarParticle();
+ particle.x = x;
+ particle.y = y;
+ game.addChild(particle);
+ particles.push(particle);
+ }
+}
+function createRockExplosion(x, y, count) {
+ for (var i = 0; i < count; i++) {
+ var particle = new RockParticle();
+ particle.x = x;
+ particle.y = y;
+ game.addChild(particle);
+ particles.push(particle);
+ }
+}
// Initialize important variables and arrays
var javelins = [];
var starpowerups = [];
var background = game.attachAsset('background', {
@@ -376,8 +431,11 @@
astronaut.vely += 10;
}
}
});
+var liftBoostActive = false;
+var liftBoostCounter = 0;
+var liftBoostResetCounter = 0;
//TODO: Mayeb half the starpowerups should travel behind the character and the moon, while the other half travel in front?
// Game tick event
LK.on('tick', function () {
//windSpeedX = 10; //Math.sin(LK.ticks) * 20;
@@ -432,11 +490,16 @@
for (var i = starpowerups.length - 1; i >= 0; i--) {
t = starpowerups[i];
if (javelin.intersects(t)) {
if (t.type == enums.STAR) {
- createDustExplosion(t.x, t.y, 10); // Example explosion effect
+ createStarExplosion(t.x, t.y, 10);
+ //speed += 0.001;
+ //javelin.radius += 1;
+ liftBoostActive = true;
+ liftBoostCounter += 10;
+ liftBoostResetCounter += 10;
} else if (t.type == enums.ROCK) {
- createDustExplosion(t.x, t.y, 10); // Example explosion effect
+ createRockExplosion(t.x, t.y, 10);
}
// Handle collision effect, e.g., increase score, create explosion, etc.
//LK.setScore(LK.getScore() + 50); // Example score increase
//t.destroy(); // Remove the starpowerup from the game
@@ -444,8 +507,25 @@
t.x = 0;
t.reset();
}
}
+ if (liftBoostActive) {
+ if (liftBoostCounter > 0) {
+ liftBoostCounter--;
+ javelin.radius += 3;
+ javelin.rotation += 0.1;
+ } else {
+ lifeBoostCounter = 0;
+ if (liftBoostResetCounter > 0) {
+ liftBoostResetCounter--;
+ javelin.radius -= 3;
+ javelin.rotation -= 0.1;
+ } else {
+ liftBoostResetCounter = 0;
+ liftBoostActive = false;
+ }
+ }
+ }
for (var i = javelins.length - 1; i >= 0; i--) {
// Update the score and scorelabel text every frame when thrown is true.
LK.setScore(LK.getScore() + 100 * speed);
scoreTxt.setText(LK.getScore());
pixelart. a beautiful moon.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixelart a beautiful starry sky seen in empty outer space.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixelart. a javelin used for olympic games and athletics. Just the spear itself, horizontally laid out in the image. It should be a slim metal spear, pointy in both ends, and with a grip somewhere off center of the shaft.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixelart. a metallic triangular pointer.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixelart lettering of the word 'LUNAR' with some blank space around it.
replace inpainted area with transparency.
pixelart. asteroid with craters. subtle shading.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixelart. asteroid with craters. subtle shading.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A small light yellow star.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
delete the inpainted areas.
Pixelart. A background window for an in-game shop, with a space theme. The center part should be a large blank area with space for the items and labels for sale in the game shop. The blank space could have the form of a black computer screen inside a spaceship.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Pixelart. An icon of a an arm holding javelin with fire around it.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Turn in-painted area solid blue like the area around it.
Pixelart. A rectangular silvery button with the text 'CLOSE'.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.