User prompt
in item2 down, after adding new starpowerups, please reset the shop layer depth to be on top of the new starpowerups.
Code edit (11 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'setText')' in or related to this line: 'item1.costTxt.setText('' + item1.price);' Line Number: 346
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'alpha')' in or related to this line: 'item1.upgradeButton.alpha = 0.5;' Line Number: 365
User prompt
in the shopwindow.show function, please set the three items' upgradebuttons to alpha 0.5 if player's coins are lower than their respective prices.
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'upgradeButton')' in or related to this line: 'self.item1.upgradeButton.alpha = 0.5;' Line Number: 365
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'price')' in or related to this line: 'if (coins < self.item1.price) {' Line Number: 364
Code edit (10 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'price')' in or related to this line: 'if (coins < self.item1.price) {' Line Number: 364
Code edit (10 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'hide')' in or related to this line: 'game.shop.hide();' Line Number: 89
Code edit (1 edits merged)
Please save this source code
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
===================================================================
--- original.js
+++ change.js
@@ -53,10 +53,13 @@
});
self.down = function (x, y, obj) {
//shop.hide();
console.log('closebutton clicked, shopInstance is: ' + self.shopInstance);
- self.shopInstance.hide();
//self.shopInstance.hide();
+ shop.visible = false;
+ instructionTxt.setText('Tap to throw the javelin');
+ instructionTxt.alpha = 1;
+ //self.shopInstance.hide();
};
});
// DustParticle class
var DustParticle = Container.expand(function () {
@@ -326,8 +329,17 @@
//closeButton.down = function (x, y, obj) {
// Method to show the shop window
self.show = function () {
self.visible = true;
+ if (coins < item1.price) {
+ item1.upgradeButton.alpha = 0.5;
+ }
+ if (coins < item2.price) {
+ item2.upgradeButton.alpha = 0.5;
+ }
+ if (coins < item3.price) {
+ item3.upgradeButton.alpha = 0.5;
+ }
// Additional logic to animate the shop window appearance could be added here
};
// Method to hide the shop window
self.hide = function () {
@@ -489,9 +501,10 @@
var ASTEROIDS_ON = false;
var UFO_ON = false;
var particles = [];
var coins = 0;
-var playerBest = 0;
+var currentScore = 0; // Reset to 0 for each succesive throw
+var playerBest = 0; // The Best score achieved by player.
// TODO: After the first throw, if player survived, instead of going to game over, maybe offer a second launch,
// this time with an incoming asteroid field or lumnious field (powerups) in order to introduce those sequentially.
// There could even be text clues to introduce them. 'The javelin will accellerate passing through those energy fields.'
// Those asteroids are brittle. etc.
@@ -598,8 +611,11 @@
var shop = new ShopWindow();
game.addChild(shop);
shop.show();
game.on('down', function (x, y, obj) {
+ if (shop.visible) {
+ return;
+ }
if (!started) {
started = true;
//gameLogo.alpha = 0;
instructionTxt.alpha = 0;
@@ -679,9 +695,10 @@
actionMeterPointer.speed *= -1;
}
}
if (thrown && !landed) {
- if (astronaut.scale.x == 1 && LK.getScore() > 200) {
+ //if (astronaut.scale.x == 1 && LK.getScore() > 200) {
+ if (astronaut.scale.x == 1 && currentScore > 200) {
astronaut.scale.x = -1;
instructionTxt.setText("Don't get hit! Tap to jump!");
instructionTxt.alpha = 1;
instructionTxt.y = -1200;
@@ -736,16 +753,25 @@
}
}
for (var i = javelins.length - 1; i >= 0; i--) {
// Update the score and scorelabel text every frame when thrown is true.
+ currentScore += Math.round(100 * speed);
+ scoreTxt.setText(currentScore);
+ if (currentScore > playerBest) {
+ playerBest = currentScore;
+ bestScoreTxt.setText('Best: ' + playerBest);
+ LK.setScore(playerBest);
+ }
+ /*
LK.setScore(LK.getScore() + 100 * speed);
scoreTxt.setText(LK.getScore());
if (LK.getScore() > playerBest) {
playerBest = LK.getScore();
bestScoreTxt.setText('Best: ' + playerBest);
- }
+ }*/
javelins[i]._move_migrated();
- if (LK.getScore() > 300 && javelins[i].intersects(astronaut) && astronaut.y >= 818) {
+ //if (LK.getScore() > 300 && javelins[i].intersects(astronaut) && astronaut.y >= 818) {
+ if (currentScore > 300 && javelins[i].intersects(astronaut) && astronaut.y >= 818) {
landed = true;
createImpactExplosion(astronaut.x, astronaut.y, 20);
astronaut.removeChildAt(0);
astronaut.attachAsset('athlete-hit', {
@@ -779,8 +805,22 @@
//LK.showGameOver();
//instructionTxt.setText('SHOP\nHere you can spend the coins you collected.');
instructionTxt.alpha = 0;
shop.show();
+ //resetForNextThrow();
+ started = false;
+ thrown = false;
+ landed = false;
+ liftBoostActive = false;
+ liftBoostCounter = 0;
+ liftBoostResetCounter = 0;
+ javelins = [];
+ javelin.destroy();
+ javelin = game.addChild(new Javelin());
+ javelin.x = astronaut.x - 70;
+ javelin.y = astronaut.y;
+ astronaut.scale.x = 1;
+ currentScore = 0;
}
}
if (playerHit) {
javelin._move_migrated();
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.