User prompt
move the spider up 70
User prompt
move the spider up by 30 pixels
User prompt
make the spider twice as big
User prompt
add a spider to the lower left of the screen
User prompt
when the empty heart appears it should flash red for a second
User prompt
when the player loses a heart replace it with an empty heart
User prompt
The plant isn't returning to the correct spawn point when it dies
User prompt
move the hearts up 20
User prompt
move the hearts down 40 pixels
User prompt
move the hearts up 100
User prompt
move the hearts up 100 pixels
User prompt
move the hearts down 800 pixels
User prompt
move the hearts right 60 pixels
User prompt
move the hearts right 120 pixels
User prompt
move the hearts right by 400 pixels
User prompt
move the hearts down by 1200 pixels
User prompt
I can't see the hearts
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'addChild')' in this line: 'LK.gui.bottomCenter.addChild(heart);' Line Number: 203
User prompt
the hearts should be bottom center
User prompt
move the hearts to the top layer
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'addChild')' in this line: 'LK.gui.bottomCenter.addChild(heart);' Line Number: 203
User prompt
move the hearts to the bottom center of the screen
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'addChild')' in this line: 'LK.gui.bottomCenter.addChild(heart);' Line Number: 203
User prompt
Move the hearts to the bottom center of the screen
User prompt
move the plant up another 50 pixels
var RightBee = Container.expand(function () { var self = Container.call(this); var beeGraphics = self.createAsset('bee', 'Bee Graphics', .5, .5); beeGraphics.scale.x = 1.2; beeGraphics.scale.y = 1.2; self.spawnBee = function () { self.x = 2048 + 100; self.y = Math.random() * (2732 / 2); self.xSpeed = -(Math.random() * 7 + 3); }; self.spawnBee(); self.move = function () { self.x += self.xSpeed; if (self.x < -50) { self.y = Math.random() * (2732 / 2); self.xSpeed = -(Math.random() * 7 + 3); self.x = 2048 + 100; } }; }); var LeftBee = Container.expand(function () { var self = Container.call(this); var beeGraphics = self.createAsset('bee', 'Bee Graphics', .5, .5); beeGraphics.scale.x = -1.2; beeGraphics.scale.y = 1.2; self.spawnBee = function () { self.x = -100; self.y = Math.random() * (2732 / 2); self.xSpeed = Math.random() * 7 + 3; }; self.spawnBee(); self.move = function () { self.x += self.xSpeed; if (self.x > 2048 + 50) { self.y = Math.random() * (2732 / 2); self.xSpeed = Math.random() * 7 + 3; self.x = -100; } }; }); var Bee = Container.expand(function () { var self = Container.call(this); var beeGraphics = self.createAsset('bee', 'Bee Graphics', .5, .5); beeGraphics.scale.x = 1.8; beeGraphics.scale.y = 1.2; self.spawnBee(); }); var Heart = Container.expand(function () { var self = Container.call(this); var heartGraphics = self.createAsset('heart', 'Heart Graphics', .5, .5); }); var Fly = Container.expand(function () { var self = Container.call(this); var flyGraphics = self.createAsset('fly', 'Fly Graphics', .5, .5); self.spawnFly = function () { var direction = Math.random() < 0.5 ? -1 : 1; self.xSpeed = direction * (Math.random() * 10 + 5); self.x = direction > 0 ? -50 : 2048 + 50; self.y = Math.random() * (2732 * 3 / 4 - self.height - LK.gui.topRight.height); var scale = 1 + self.y / (2732 * 3 / 4) * 0.2; self.scale.x = self.scale.y = scale; }; self.spawnFly(); self.move = function () { if (self.xSpeed > 0 && self.x > 2048 / 2 && !self.changedDirection || self.xSpeed < 0 && self.x < 2048 / 2 && !self.changedDirection) { self.xSpeed *= -1; self.changedDirection = true; } if (self.xSpeed > 0) { flyGraphics.scale.x = 1; } else if (self.xSpeed < 0) { flyGraphics.scale.x = -1; } self.x += self.xSpeed; if (self.x > 2048 + 50 || self.x < -50) { self.spawnFly(); } }; }); var Plant = Container.expand(function () { var self = Container.call(this); self.isMoving = false; self.launchAt = function (x, y) { var startX = self.x; var startY = self.y; var endX = x; var endY = y; var time = 0; self.isMoving = true; self.fliesCaughtInJump = 0; if (x > 2048 / 2) { self.scale.x = -1; } else { self.scale.x = 1; } self.moveTowards = function () { if (time <= 30) { self.x = startX + (endX - startX) * (time / 30); self.y = startY - (startY - endY) * (time / 30); time++; } else if (time <= 90) { self.x = endX - (endX - startX) * ((time - 30) / 60); self.y = endY + (startY - endY) * ((time - 30) / 60); time++; } else { self.isMoving = false; self.moveTowards = null; self.parent.targetScore += self.fliesCaughtInJump * 100 + self.parent.bonusScore; self.fliesCaughtInJump = 0; self.parent.bonusScore = 0; } }; }; var plantGraphics = self.createAsset('plant', 'Plant Graphics', .5, .5); self.catchFly = function (fly) { if (self.intersects(fly)) { fly.destroy(); self.fliesCaughtInJump = (self.fliesCaughtInJump || 0) + 1; if (fly.y < 2732 / 3) { self.parent.bonusScore += 150; } return true; } return false; }; self.hitByBee = function (bee) { if (self.intersects(bee) && !self.hit) { self.hit = true; LK.effects.flashObject(self, 0xff0000, 1000); self.x = 2048 / 2; self.y = 2732 - self.height; self.parent.loseHeart(); if (self.isMoving) { self.isMoving = false; self.moveTowards = null; } LK.setTimeout(function () { self.hit = false; }, 1000); return true; } return false; }; }); var Game = Container.expand(function () { var self = Container.call(this); self.scoreTxt = new Text2('0', { size: 120, fill: "#ffff00", align: 'right' }); LK.gui.topRight.addChild(self.scoreTxt); self.scoreTxt.anchor.set(1, 0); self.scoreTxt.x = LK.gui.topRight.width - self.scoreTxt.width - 20; self.scoreTxt.y = 20; self.targetScore = 0; self.bonusScore = 0; self.targetScore = 0; self.currentScore = 0; self.updateScore = function (fliesCaught) { if (!plant.isMoving) { self.targetScore += fliesCaught * (fliesCaught > 1 ? 150 : 100); } }; LK.on('tick', function () { if (!plant.isMoving && self.currentScore < self.targetScore) { self.currentScore += 5; if (self.currentScore > self.targetScore) { self.currentScore = self.targetScore; } self.scoreTxt.setText(self.currentScore); } }); stage.on('down', function (obj) { if (!plant.isMoving && !plant.hit) { var pos = obj.event.getLocalPosition(self); plant.launchAt(pos.x, pos.y); } }); var background = self.createAsset('background', 'Background Graphics', 0, 0); background.width = 2048; background.height = 2732; self.addChildAt(background, 0); var flies = []; var plant = self.addChild(new Plant()); plant.x = 2048 / 2; plant.y = 2732 - plant.height - 100; self.incrementScoreAmount = 100; var hearts = []; self.loseHeart = function () { if (hearts.length > 0) { var lostHeart = hearts.pop(); lostHeart.destroy(); } if (hearts.length === 0) { isGameOver = true; } }; for (var i = 0; i < 3; i++) { var heart = new Heart(); heart.x = 20 + i * (heart.width + 10); heart.y = 1220; LK.gui.topLeft.addChild(heart); hearts.push(heart); } var isGameOver = false; var flySpawnTimer = 0; var bees = []; var leftBee = new LeftBee(); bees.push(leftBee); self.addChild(leftBee); var rightBee = new RightBee(); bees.push(rightBee); self.addChild(rightBee); LK.on('tick', function () { for (var a = flies.length - 1; a >= 0; a--) { if (flies[a]) { flies[a].move(); if (flies[a].x > 2048 + 50) { flies[a].destroy(); flies.splice(a, 1); } } } flySpawnTimer++; if (flySpawnTimer >= 120 && flies.length < 5) { var newFly = new Fly(); flies.push(newFly); self.addChild(newFly); flySpawnTimer = 0; } for (var a = flies.length - 1; a >= 0; a--) { if (plant.catchFly(flies[a])) { flies.splice(a, 1); } } if (plant.moveTowards) { plant.moveTowards(); } bees.forEach(function (bee) { bee.move(); if (plant.hitByBee(bee)) {} }); if (isGameOver) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } }); });
===================================================================
--- original.js
+++ change.js
@@ -198,9 +198,9 @@
};
for (var i = 0; i < 3; i++) {
var heart = new Heart();
heart.x = 20 + i * (heart.width + 10);
- heart.y = 20;
+ heart.y = 1220;
LK.gui.topLeft.addChild(heart);
hearts.push(heart);
}
var isGameOver = false;
Simple side view of a pixel art fly on a sky blue background Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Head of a carnivorous plant, mouth open at top, pixel art Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Pixel art heart green Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a jungle with light streaming in from above, pixel art Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a pixel art bee, cute, side view, flying, no shadow Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a dark green box surrounded by vines, pixel art Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a blackened cracked heart, pixel art, no shadow Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a cute orange-yellow spider, side view, pixel art, fangs, no shadow Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.