User prompt
Fix Bug: 'TypeError: scoreTxt.getText is not a function' in this line: 'scoreTxt.setText(parseInt(scoreTxt.getText()) + 1);' Line Number: 56
User prompt
Fix Bug: 'TypeError: parseInt is not a function' in this line: 'scoreTxt.setText(parseInt(scoreTxt.text) + 1);' Line Number: 56
User prompt
Fix Bug: 'TypeError: scoreTxt.getText is not a function' in this line: 'scoreTxt.setText(parseInt(scoreTxt.getText()) + 1);' Line Number: 56
User prompt
Fix Bug: 'TypeError: parseInt is not a function' in this line: 'scoreTxt.setText(parseInt(scoreTxt.text) + 1);' Line Number: 56
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'drop')' in this line: 'daggers[a].drop();' Line Number: 52
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'drop')' in this line: 'daggers[a].drop();' Line Number: 52
Initial prompt
Dagger Drop
var Dagger = Container.expand(function () {
var self = Container.call(this);
var daggerGraphics = self.createAsset('dagger', 'Dagger Graphics', .5, .5);
self.speed = 0;
self.drop = function () {
self.y += self.speed;
};
});
var Target = Container.expand(function () {
var self = Container.call(this);
var targetGraphics = self.createAsset('target', 'Target Graphics', .5, .5);
});
var Game = Container.expand(function () {
var self = Container.call(this);
var daggers = [];
var targets = [];
var scoreTxt = new Text2('0', {
size: 150,
fill: "#ffffff"
});
scoreTxt.anchor.set(.5, 0);
LK.gui.topCenter.addChild(scoreTxt);
var target = self.addChild(new Target());
target.x = 2048 / 2;
target.y = 2732 / 2;
var dragNode = null;
var isGameOver = false;
var tickOffset = 0;
stage.on('down', function (obj) {
var newDagger = new Dagger();
newDagger.x = obj.event.getLocalPosition(self).x;
newDagger.y = obj.event.getLocalPosition(self).y;
daggers.push(newDagger);
self.addChild(newDagger);
dragNode = newDagger;
});
stage.on('move', function (obj) {
var pos = obj.event.getLocalPosition(self);
if (dragNode) {
dragNode.x = pos.x;
dragNode.y = pos.y;
}
});
stage.on('up', function (obj) {
if (dragNode) {
dragNode.speed = 5;
}
dragNode = null;
});
LK.on('tick', function () {
for (var a = daggers.length; a >= 0; a--) {
daggers[a].drop();
if (daggers[a].intersects(target)) {
daggers[a].destroy();
daggers.splice(a, 1);
scoreTxt.setText(parseInt(scoreTxt.text) + 1);
}
if (daggers[a].y > 2732) {
daggers[a].destroy();
daggers.splice(a, 1);
isGameOver = true;
}
}
if (isGameOver) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
});
});
var Dagger = Container.expand(function () {
var self = Container.call(this);
var daggerGraphics = self.createAsset('dagger', 'Dagger Graphics', .5, .5);
self.speed = 0;
self.drop = function () {
self.y += self.speed;
};
});
var Target = Container.expand(function () {
var self = Container.call(this);
var targetGraphics = self.createAsset('target', 'Target Graphics', .5, .5);
});
var Game = Container.expand(function () {
var self = Container.call(this);
var daggers = [];
var targets = [];
var scoreTxt = new Text2('0', {
size: 150,
fill: "#ffffff"
});
scoreTxt.anchor.set(.5, 0);
LK.gui.topCenter.addChild(scoreTxt);
var target = self.addChild(new Target());
target.x = 2048 / 2;
target.y = 2732 / 2;
var dragNode = null;
var isGameOver = false;
var tickOffset = 0;
stage.on('down', function (obj) {
var newDagger = new Dagger();
newDagger.x = obj.event.getLocalPosition(self).x;
newDagger.y = obj.event.getLocalPosition(self).y;
daggers.push(newDagger);
self.addChild(newDagger);
dragNode = newDagger;
});
stage.on('move', function (obj) {
var pos = obj.event.getLocalPosition(self);
if (dragNode) {
dragNode.x = pos.x;
dragNode.y = pos.y;
}
});
stage.on('up', function (obj) {
if (dragNode) {
dragNode.speed = 5;
}
dragNode = null;
});
LK.on('tick', function () {
for (var a = daggers.length; a >= 0; a--) {
daggers[a].drop();
if (daggers[a].intersects(target)) {
daggers[a].destroy();
daggers.splice(a, 1);
scoreTxt.setText(parseInt(scoreTxt.text) + 1);
}
if (daggers[a].y > 2732) {
daggers[a].destroy();
daggers.splice(a, 1);
isGameOver = true;
}
}
if (isGameOver) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
});
});
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