User prompt
use LK.setScore and LK.getScore for the scoring system
User prompt
actually, ;et's only add +2 points per remaining dagger
User prompt
now let's also award points per remaining daggers. Players have 5 daggers per round, and I want to reward them for managing to finish the level with extra daggers. So let's add +3 points per extra saved dagger. That means if the player managed to clear the entire level with a single dagger, he would have 4 saved daggers, which would award +3 points each for a total of 12 points. using 4 daggers to clear the level would only award +3 points to the score, since a single dagger was saved from the starting 5
User prompt
let's improve the scoring system. keep awarding 1 point per destroyed target, however if the player managed to destroy multiple targets using the same dagger, add 1 point per extra target. So the first target destroyed would only award 1 point, the second target popped using the same dagger would award 2 points, the third target would award 3 points and so on.
User prompt
after popping the last target that would advance the player to the next level, introduce a 300 miliseconds delay
User prompt
targets gain 33% speed increase compared to the previous one. lower that to only 25%
User prompt
award 1 point per target instead of 10
User prompt
can you start level 1 with 4 targets instead of 3? that would mean the next level would have 5 targets and so on
User prompt
not sure wht happens, but after the level advances, the dagger that destroyed the last target which triggers the level advancement, remains on the screen. that daggers remains stuck on the position where it hit the last target
User prompt
only count the remaining daggers that were unused. once a dagger is dropped, it doesn't add any extra 50 points, only the ones that were not used out of the 5 ones. so if a player managed to hit all the targets with a single dagger and the level advances, only the 4 remaining ones award points, so 4 daggers remaining times 50 each adds an extra 200 points
User prompt
i said that each remaining dagger should only add 50 points to the score. so havin 1 extra dagger left when the level ends adds 50 points, having 2 extra daggers adds 100 points and so on
User prompt
i said that each remaining dagger should only add 50 points to the score. so havin 1 extra dagger left when the level ends adds 50 points, having 2 extra daggers adds 100 points and so on
User prompt
remaining daggers should add 50 points to the score each. so if the player starts with 5 daggers, but managed toi complete a level with 2 daggers left, he should get 100 extra points, 50 for each dagger left
User prompt
i need to see the daggeredge at the bottom of the screen
User prompt
that didnt work, the level doesnt wait for the dagger to hit the daggeredge in order to advance to the next level
User prompt
To ensure that the game advances to the next level only after the last dagger has reached the bottom of the screen and the combo check is completed, you should adjust the logic in the tick function. Here's a step-by-step guide on what you need to do: Separate Combo Display and Level Advancement Logic: Ensure that the logic for displaying the combo and the logic for advancing to the next level are distinct and not intertwined. This helps in managing the flow of the game more effectively. Use a Flag for Level Completion: Introduce a boolean flag (e.g., isLevelComplete) that is set to true when all targets are destroyed but is used to delay the level advancement until after the last dagger's actions are completed. Check for Last Dagger's Completion: In the section where you check if the dagger has reached the bottom of the screen (daggers[a].y > 2732), after executing the combo display logic, add a check to see if this is the last dagger in play. If it is, and if the isLevelComplete flag is true, then proceed with the level advancement. Modify Target Destruction Logic: When a target is hit and destroyed, check if all targets are destroyed. If they are, set the isLevelComplete flag to true. Do not advance to the next level immediately. Advancing to the Next Level: In the section where you would normally advance to the next level, modify the logic to also check the isLevelComplete flag and whether all daggers have completed their actions (e.g., reached the bottom or destroyed).
User prompt
Fix Bug: 'TypeError: self.getChildByType is not a function' in this line: 'if (daggers[a] && daggers[a].intersects(self.getChildByType(DaggerEdge))) {' Line Number: 175
User prompt
Fix Bug: 'TypeError: self.getChildByName is not a function' in this line: 'if (daggers[a] && daggers[a].intersects(self.getChildByName('DaggerEdge'))) {' Line Number: 175
User prompt
Fix Bug: 'TypeError: self.getChildByType is not a function' in this line: 'if (daggers[a] && daggers[a].intersects(self.getChildByType('DaggerEdge'))) {' Line Number: 175
User prompt
Fix Bug: 'TypeError: self.getChildByType is not a function' in this line: 'if (daggers[a] && daggers[a].intersects(self.getChildByType(DaggerEdge))) {' Line Number: 175
User prompt
Fix Bug: 'TypeError: self.getChildByName is not a function' in this line: 'if (daggers[a] && daggers[a].intersects(self.getChildByName('DaggerEdge'))) {' Line Number: 175
User prompt
Fix Bug: 'TypeError: self.getChildByName is not a function' in this line: 'if (daggers[a] && daggers[a].intersects(self.getChildByName('DaggerEdge'))) {' Line Number: 175
User prompt
Fix Bug: 'TypeError: self.getChildByClass is not a function' in this line: 'if (daggers[a] && daggers[a].intersects(self.getChildByClass(DaggerEdge))) {' Line Number: 175
User prompt
Fix Bug: 'TypeError: self.getChildByType is not a function' in this line: 'if (daggers[a] && daggers[a].intersects(self.getChildByType(DaggerEdge))) {' Line Number: 175
User prompt
Fix Bug: 'TypeError: self.getChildByName is not a function' in this line: 'if (daggers[a] && daggers[a].intersects(self.getChildByName('daggerEdge'))) {' Line Number: 175
var DoubleCombo = Container.expand(function () { var self = Container.call(this); var comboGraphics = self.createAsset('comboDouble', 'Double Combo Graphics', .5, .5); self.x = 2048 / 2; self.y = 2732 / 2; self.show = function () { self.visible = true; LK.setTimeout(function () { self.destroy(); }, 1500); }; self.visible = false; }); var TripleCombo = Container.expand(function () { var self = Container.call(this); var comboGraphics = self.createAsset('comboTriple', 'Triple Combo Graphics', .5, .5); self.x = 2048 / 2; self.y = 2732 / 2; self.show = function () { self.visible = true; LK.setTimeout(function () { self.destroy(); }, 1500); }; self.visible = false; }); var MultiCombo = Container.expand(function () { var self = Container.call(this); var comboGraphics = self.createAsset('comboMulti', 'Multi Combo Graphics', .5, .5); self.x = 2048 / 2; self.y = 2732 / 2; self.show = function () { self.visible = true; LK.setTimeout(function () { self.destroy(); }, 1500); }; self.visible = false; }); var Explosion = Container.expand(function () { var self = Container.call(this); var explosionGraphics = self.createAsset('explosion', 'Explosion Graphics', .5, .5); self.visible = false; self.show = function () { self.visible = true; LK.setTimeout(function () { self.destroy(); }, 100); }; }); 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.targetsHit = 0; 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 * (1 + 0.25 * index); 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 background = self.createAsset('background', 'Background Image', 0, 0); background.width = 2048; background.height = 2732; var daggers = []; var targets = []; var scoreTxt = new Text2(currentScore.toString(), { size: 150, fill: "#ffffff", stroke: "#000000", strokeThickness: 11.25, font: "'Luckiest Guy', 'Arial Black', sans-serif" }); 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 + 3; i++) { var target = self.addChild(new Target(i)); target.x = Math.random() * 2048; target.y = 2732 / 2 + i * targetSpacing - 1200 - 100 + 500 + 300; 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])) { var explosion = self.addChild(new Explosion()); explosion.x = targets[b].x; explosion.y = targets[b].y; explosion.show(); self.removeChild(targets[b]); targets.splice(b, 1); daggers[a].targetsHit++; LK.setScore(LK.getScore() + daggers[a].targetsHit); scoreTxt.setText(LK.getScore().toString()); break; } } if (daggers[a] && daggers[a].y > 2732) { var comboCount = daggers[a].targetsHit; var comboType = comboCount === 2 ? 'Double' : comboCount === 3 ? 'Triple' : comboCount >= 4 ? 'Multi' : ''; if (comboCount === 2) { var doubleCombo = new DoubleCombo(); self.addChildAt(doubleCombo, self.children.indexOf(background) + 1); doubleCombo.show(); } else if (comboCount === 3) { var tripleCombo = new TripleCombo(); self.addChildAt(tripleCombo, self.children.indexOf(background) + 1); tripleCombo.show(); } else if (comboCount >= 4) { var multiCombo = new MultiCombo(); self.addChildAt(multiCombo, self.children.indexOf(background) + 1); multiCombo.show(); } daggers[a].destroy(); daggers.splice(a, 1); if (daggers.length > 0) { dragNode = daggers[daggers.length - 1]; dragNode.isDropping = false; dragNode.targetsHit = 0; } else if (targets.length === 0) { currentLevel++; daggers = []; if (currentLevel <= 12) { addTargets(currentLevel); } else { isGameOver = true; } } } } if ((isGameOver || daggers.length === 0) && targets.length > 0) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } else if (targets.length === 0) { var remainingDaggers = daggers.length; for (var i = 0; i < remainingDaggers; i++) { daggers[i].destroy(); } LK.setScore(LK.getScore() + remainingDaggers * 2); scoreTxt.setText(LK.getScore().toString()); daggers = []; currentLevel++; 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; } } } }); });
===================================================================
--- original.js
+++ change.js
@@ -99,11 +99,9 @@
var background = self.createAsset('background', 'Background Image', 0, 0);
background.width = 2048;
background.height = 2732;
var daggers = [];
- var currentScore = 0;
var targets = [];
- var currentScore = 0;
var scoreTxt = new Text2(currentScore.toString(), {
size: 150,
fill: "#ffffff",
stroke: "#000000",
@@ -158,10 +156,10 @@
explosion.show();
self.removeChild(targets[b]);
targets.splice(b, 1);
daggers[a].targetsHit++;
- currentScore += daggers[a].targetsHit;
- scoreTxt.setText(currentScore.toString());
+ LK.setScore(LK.getScore() + daggers[a].targetsHit);
+ scoreTxt.setText(LK.getScore().toString());
break;
}
}
if (daggers[a] && daggers[a].y > 2732) {
@@ -204,10 +202,10 @@
var remainingDaggers = daggers.length;
for (var i = 0; i < remainingDaggers; i++) {
daggers[i].destroy();
}
- currentScore += remainingDaggers * 2;
- scoreTxt.setText(currentScore.toString());
+ LK.setScore(LK.getScore() + remainingDaggers * 2);
+ scoreTxt.setText(LK.getScore().toString());
daggers = [];
currentLevel++;
addTargets(currentLevel);
for (var i = 0; i < 5; i++) {
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