User prompt
add border to font in diamond coutner
User prompt
make diamond coutner font text black
Code edit (3 edits merged)
Please save this source code
User prompt
make diamond icon transparent
Code edit (1 edits merged)
Please save this source code
User prompt
move diamond counter 200 pixels to the left and 200 down
User prompt
move diamond coutner 200 pixels to the left
User prompt
make diamon icon transparent
User prompt
bring diaamond coutner in front of diamond icon
User prompt
move diamond counter 200 pxels to the left but do not move icon
User prompt
move diaomnd iconn 100 pixels to the right but do not move counter
User prompt
center diamons counter in the middle of the diamond icon
User prompt
move diamond icon 200 pixles to the right
User prompt
move diaomnd counter number 200 pixels to the left but do not move diaomn icon
User prompt
move diamond counter 200 pixels to the left
User prompt
move diaomnd coutner 200 pixels to the left
User prompt
show diamond count in front of diamond icon
User prompt
instead of diamons text in the top right, use the diamond asset. counter should be inside the diamond
User prompt
Please fix the bug: 'TypeError: diamondCounterTxt.setText is not a function' in or related to this line: 'diamondCounterTxt.setText(diamondCount.toString());' Line Number: 431
User prompt
instead of diamons text in the top right, use the diamond asset
User prompt
replace coing references by diamond
User prompt
add pop effect when diamon spawns moving upwards and then fast downwards
Code edit (1 edits merged)
Please save this source code
User prompt
coins shpeed should be slower than stars
User prompt
coins should increase and dedcrease their size way less
===================================================================
--- original.js
+++ change.js
@@ -88,31 +88,8 @@
self.update = function () {
self.y += self.speed;
};
});
-// Coin class
-var Coin = Container.expand(function () {
- var self = Container.call(this);
- var coinGraphics = self.attachAsset('coin', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.speed = 4;
- self.update = function () {
- self.y += self.speed;
- self.rotation += 0.05; // Add rotation animation
- if (LK.ticks % 120 < 60) {
- self.scale.x += 0.002;
- self.scale.y += 0.002;
- } else {
- self.scale.x -= 0.002;
- self.scale.y -= 0.002;
- }
- if (self.y > 2732) {
- self.destroy();
- }
- };
-});
// Diamond class
var Diamond = Container.expand(function () {
var self = Container.call(this);
var diamondGraphics = self.attachAsset('diamond', {
@@ -120,11 +97,8 @@
anchorY: 0.5
});
self.speed = 4;
self.update = function () {
- if (self.y < 200) {
- self.speed = 10; // Move fast downwards after reaching a certain height
- }
self.y += self.speed;
self.rotation += 0.05; // Add rotation animation
if (LK.ticks % 120 < 60) {
self.scale.x += 0.002;
@@ -333,10 +307,10 @@
var enemies = [];
var scoreTxt;
var score = 0;
var dragNode = null;
-var coinCount = 0; // Initialize coin counter
-var coinCounterTxt; // Declare coinCounterTxt variable
+var diamondCount = 0; // Initialize diamond counter
+var diamondCounterTxt; // Declare diamondCounterTxt variable
var isFairyHeld = false; // Track if the fairy is being held
var waveCount = 0; // Track the wave count
var waveConfig = [{
enemies: 4,
@@ -372,16 +346,16 @@
scoreTxt.anchor.set(0.5, 0);
// Create coin counter text
game.addChild(scoreTxt);
// Create coin counter text
- coinCounterTxt = new Text2('Coins: 0', {
+ diamondCounterTxt = new Text2('Diamonds: 0', {
size: 100,
fill: "#ffffff"
});
- coinCounterTxt.anchor.set(1, 0); // Anchor to the top right
- coinCounterTxt.x = 2048 - 20; // Position at the top right of the screen with a margin
- coinCounterTxt.y = 20; // Position with a margin from the top
- game.addChild(coinCounterTxt);
+ diamondCounterTxt.anchor.set(1, 0); // Anchor to the top right
+ diamondCounterTxt.x = 2048 - 20; // Position at the top right of the screen with a margin
+ diamondCounterTxt.y = 20; // Position with a margin from the top
+ game.addChild(diamondCounterTxt);
// Set up game event listeners
game.down = function (x, y, obj) {
dragNode = fairy;
isFairyHeld = true; // Set isFairyHeld to true when the fairy is held
@@ -438,12 +412,12 @@
for (var i = game.children.length - 1; i >= 0; i--) {
if (game.children[i] instanceof Star) {
game.children[i].update();
}
- if (game.children[i] instanceof Coin && game.children[i].intersects(fairy)) {
+ if (game.children[i] instanceof Diamond && game.children[i].intersects(fairy)) {
game.children[i].destroy();
- coinCount++;
- coinCounterTxt.setText('Coins: ' + coinCount);
+ diamondCount++;
+ diamondCounterTxt.setText('Diamonds: ' + diamondCount);
}
}
// Update bullets
for (var i = bullets.length - 1; i >= 0; i--) {
@@ -526,22 +500,17 @@
score++;
scoreTxt.setText(score);
var dropChance = Math.random();
if (dropChance < 0.2) {
- var newCoin = new Coin();
- newCoin.x = enemyX;
- newCoin.y = enemyY;
- game.addChild(newCoin);
+ var newDiamond = new Diamond();
+ newDiamond.x = enemyX;
+ newDiamond.y = enemyY;
+ game.addChild(newDiamond);
} else if (dropChance < 0.2) {
var newPowerup = new Powerup();
newPowerup.x = enemyX;
newPowerup.y = enemyY;
game.addChild(newPowerup);
- } else if (dropChance < 0.1) {
- var newDiamond = new Diamond();
- newDiamond.x = enemyX;
- newDiamond.y = enemyY;
- game.addChild(newDiamond);
}
if (enemies[j] instanceof Boss) {
// Create bigger particle effect for boss
for (var p = 0; p < 50; p++) {
@@ -574,12 +543,12 @@
}
// Check for collisions
// Check for coin collection
for (var i = game.children.length - 1; i >= 0; i--) {
- if (game.children[i] instanceof Coin && game.children[i].intersects(fairy)) {
+ if (game.children[i] instanceof Diamond && game.children[i].intersects(fairy)) {
game.children[i].destroy();
- coinCount++;
- coinCounterTxt.setText('Coins: ' + coinCount);
+ diamondCount++;
+ diamondCounterTxt.setText('Diamonds: ' + diamondCount);
}
}
for (var k = bullets.length - 1; k >= 0; k--) {
for (var l = enemies.length - 1; l >= 0; l--) {
@@ -596,12 +565,12 @@
scoreTxt.setText(score);
// Randomly drop coins or powerups
var dropChance = Math.random();
if (dropChance < 0.2) {
- var newCoin = new Coin();
- newCoin.x = enemyX;
- newCoin.y = enemyY;
- game.addChild(newCoin);
+ var newDiamond = new Diamond();
+ newDiamond.x = enemyX;
+ newDiamond.y = enemyY;
+ game.addChild(newDiamond);
} else if (dropChance < 0.2) {
var newPowerup = new Powerup();
newPowerup.x = enemyX;
newPowerup.y = enemyY;
8-bit. cartoon. white star.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
cartoon 8 bit fairy dust. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Cartoon, 8bit, fireball. Black border. Cicular.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
cartoon, 8 bit, shield. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8bit, cartoon, axe. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
dark electric ball, 8bit, cartoon.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8bit, cartoon, treasure chest frame. very big empty center. only a fine border of chest. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.