User prompt
when a new level begins, refill all 5 daggers
User prompt
it's game over after all available have been used and there's still 1 or more available targets that havent been destroyed
User prompt
the game has to restart from level 1 if all daggers have been consumed and there's still more than 1 available target present
User prompt
now we need to add levels to the game. the game starts from level 1 and only starts with the top 3 targets. after advancing to the next level, introduce one extra target so introduce target number 4. level 3 would itnroduce target 5 and so on up to level 12 when youd introduce all 14 targets. keep in mind targets are numbered from top to bottom, so the first target is the one that's closest to the upper side of the screen
User prompt
now we need to add levels to the game. the game starts from level 1 and only starts with the top 3 targets. after advancing to the next level, introduce one extra target so introduce target number 4. level 3 would itnroduce target 5 and so on up to level 12 when youd introduce all 14 targets
User prompt
we have 14 targets moving on the screen. I want you to number them (but only code-wise, these numbers should be visible on the screen) from top to bottom. so the top most target will be considered number 1, the one bellow number 2 and so on to the last arget at the bottom closest to the bottom of the screen which is number 14
User prompt
now I cant even drop the first dagger
User prompt
the nextdagger cant be dropped. I should be able to drop the next dagger after the previous one has hit the bottom part of the screen
User prompt
the game should only end after all available daggers have been used
User prompt
now the game ends as soon as I tap the screen. the game should only end afetr consuming all 5 availabel daggers
User prompt
I should only have 5 available daggers (lives). after consuming all 5 of them the game should end
User prompt
the game should end after consuming all 5 of my daggers
User prompt
great, now the next dagger load, but I have too many daggers. The level should end after consuming all the 5 available ones
User prompt
the game curently end after the 1st dagger hits the bottom of the screen. however, what should happen is that the next dagger should load, since I have 5 available ones per level
User prompt
after the first dagger hits the bottom side of the screen. the next one should load, as I have 5 daggers availabnle per level
User prompt
the next dagger should only drop after the previous one has touched the bottom side of the screen
User prompt
if I drop daggers to quickly. I only have 3 available ones before ending the level. if I drop them at longer intervals, I have more than 5. I should only have 5 per level
User prompt
the level must only have 5 available dagger.
User prompt
✅ Change the initial position of the new dagger to match the last dropped dagger's position
User prompt
right now, after loading the next active dagger, it always loads from the same position which is alligned to the middle of the screen. after dropping a dagger, the next one's horizontal position should start from the same place as the previous one that was just dropped
User prompt
right now, after loading the next active dagger, it always loads from the same position which is alligned to the middle of the screen. after dropping a dagger, the next one's horizontal position should start from the same place as the previous one that was just dropped
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'x')' in this line: 'newDagger.x = daggers[daggers.length - 1].x;' Line Number: 76
User prompt
right now, after loading the next active dagger, it always loads from the same position which is alligned to the middle of the screen. after dropping a dagger, the next one's horizontal position should start from the same place as the previous one that was just dropped
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'x')' in this line: 'newDagger.x = daggers[daggers.length - 1].x;' Line Number: 73
User prompt
right now, after loading the next active dagger, it always loads from the same position which is alligned to the middle of the screen. after dropping a dagger, the next one's horizontal position should start from the same place as the previous one that was just dropped
var Dagger = Container.expand(function () { var self = Container.call(this); var daggerGraphics = self.createAsset('dagger', 'Dagger Graphics', .5, .5); self.speed = 22 * 1.1; self.direction = 1; self.move = function () { if (!self.isDropping) { if (self.x > 2048 - self.width / 2) { self.x = 2048 - self.width / 2; self.direction *= -1; } else if (self.x < self.width / 2) { self.x = self.width / 2; self.direction *= -1; } self.x += self.speed * self.direction; } else { self.y += self.speed / 2; } }; self.isDropping = false; self.drop = function () { if (self.isDropping) { self.y += self.speed / 2; } }; }); var Target = Container.expand(function (index) { var self = Container.call(this); var targetGraphics = self.createAsset('target', 'Target Graphics', .5, .5); self.direction = index % 2 === 0 ? -1 : 1; self.speed = 2 * 3 * 1.25 * 0.9; self.move = function () { if (self.x > 2048 - self.width / 2) { self.x = 2048 - self.width / 2; self.direction *= -1; } else if (self.x < self.width / 2) { self.x = self.width / 2; self.direction *= -1; } self.x += self.speed * self.direction; }; LK.on('tick', function () { self.move(); }); }); var Game = Container.expand(function () { var self = Container.call(this); var daggers = []; var currentScore = 0; var targets = []; var currentScore = 0; var scoreTxt = new Text2(currentScore.toString(), { size: 150, fill: "#ffffff" }); scoreTxt.anchor.set(.5, 0); LK.gui.topCenter.addChild(scoreTxt); var targetSpacing = 150; var currentLevel = 1; function addTargets(level) { for (var i = 0; i < level + 2; i++) { var target = self.addChild(new Target(i)); target.x = Math.random() * 2048; target.y = 2732 / 2 - i * targetSpacing + 1200 + 100; target.number = i + 1; targets.push(target); } } addTargets(currentLevel); var dragNode = null; var isGameOver = false; var tickOffset = 0; for (var i = 0; i < 5; i++) { var newDagger = new Dagger(); newDagger.x = 2048 / 2; newDagger.y = 2732 / 4 - 200 - i * 100; daggers.push(newDagger); self.addChild(newDagger); if (i === 0) { dragNode = newDagger; newDagger.isDropping = false; } } stage.on('down', function (obj) { if (dragNode && !dragNode.isDropping) { dragNode.isDropping = true; dragNode = null; } }); LK.on('tick', function () { for (var a = daggers.length - 1; a >= 0; a--) { if (daggers[a]) { daggers[a].move(); daggers[a].drop(); } for (var b = targets.length - 1; b >= 0; b--) { if (daggers[a].intersects(targets[b])) { self.removeChild(targets[b]); targets.splice(b, 1); currentScore += 10; scoreTxt.setText(currentScore.toString()); break; } } if (daggers[a] && daggers[a].y > 2732) { daggers[a].destroy(); daggers.splice(a, 1); if (daggers.length > 0) { dragNode = daggers[daggers.length - 1]; dragNode.isDropping = false; } else if (targets.length === 0) { currentLevel++; if (currentLevel <= 12) { addTargets(currentLevel); for (var i = 0; i < 5; i++) { var newDagger = new Dagger(); newDagger.x = 2048 / 2; newDagger.y = 2732 / 4 - 200 - i * 100; daggers.push(newDagger); self.addChild(newDagger); if (i === 0) { dragNode = newDagger; dragNode.isDropping = false; } } } else { isGameOver = true; } } } } if (isGameOver && daggers.length === 0 && targets.length > 0) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } else {} }); });
===================================================================
--- original.js
+++ change.js
@@ -111,8 +111,19 @@
} else if (targets.length === 0) {
currentLevel++;
if (currentLevel <= 12) {
addTargets(currentLevel);
+ for (var i = 0; i < 5; i++) {
+ var newDagger = new Dagger();
+ newDagger.x = 2048 / 2;
+ newDagger.y = 2732 / 4 - 200 - i * 100;
+ daggers.push(newDagger);
+ self.addChild(newDagger);
+ if (i === 0) {
+ dragNode = newDagger;
+ dragNode.isDropping = false;
+ }
+ }
} else {
isGameOver = true;
}
}
dagger pointing down Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. pixel. 8 bit
pixelated cloudy sky Single Game Texture. In-Game background. 2d. High contrast. No shadows. 8 bit
white round cloud burst. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.8 bit. pixelated
colored text saying (EDGY). Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. pixelated. 8 bit
colored text saying (SHARP). Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. pixelated. 8 bit. retro
colored text saying (DEADLY). sharp dagger edges around the text. pixelated. 8 bit. retro Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
cute red balloon. looking up. feeling scared. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. pixel. 8 bit