User prompt
Move the plant up by 50 pixels
User prompt
The heart should turn red and stay red when the player loses a life
User prompt
The heart should become invisible after it flashes red
User prompt
When the player loses a life, make the heart flash red for 2 seconds before it disappears
User prompt
make the bonus score 150
User prompt
The bonus score isn't working
User prompt
I still can't see the score text
User prompt
remove the score display and recreate it. It should be yellow and appear at the top right of the screen. It should be right aligned
User prompt
When the mouse is on the right hand side of the screen flip the plant sprite
User prompt
Make it so the plant travels at a constant rate going up and double that rate on the way down
User prompt
Move the score to the front, top right of the screen
User prompt
I can't see the score any more
User prompt
move the score to the top middle
User prompt
move it to the middle of the screen
User prompt
now move it to the top right
User prompt
make the score right aligned so it never goes off the edge of the screen
User prompt
every time a fly is caught in the top 1/3 of the screen add 1 to the bonus counter
User prompt
remove the bonus counter
User prompt
Show a bonus counter on the screen
User prompt
While jumping the game should only count the number of flies and bonuses collected. When the plant lands it should give 100 points for each fly and 50 points for each bonus. this should be added to the target score.
User prompt
Fix Bug: 'ReferenceError: fly is not defined' in this line: 'if (fly.y < 2732 / 3) {' Line Number: 103
User prompt
Every time the player catches a fly in the top 1/3rd of the screen add 50 to a bonus variable. That variable should add to the target score when the plan lands
User prompt
Fix Bug: 'ReferenceError: fly is not defined' in this line: 'self.parent.lastCaughtFlyY = fly.y;' Line Number: 103
User prompt
Fix Bug: 'ReferenceError: fly is not defined' in this line: 'self.targetScore += fliesCaught * ((fliesCaught > 1 ? 150 : 100) + (fly.y < 2732 / 3 ? 50 : 0));' Line Number: 143
User prompt
Flies in the top third of the screen earn an extra 50 points
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; self.moveTowards = function () { if (time <= 60) { self.x = startX + (endX - startX) * (time / 60); self.y = startY - (startY - endY) * (time / 60); time++; } else if (time <= 120) { self.x = endX - (endX - startX) * ((time - 60) / 60); self.y = endY + (startY - endY) * ((time - 60) / 60); time++; } else { self.isMoving = false; self.moveTowards = null; self.parent.targetScore += self.fliesCaughtInJump * 100; self.fliesCaughtInJump = 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.bonusCounter += 1; } 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.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; self.scoreTxt = new Text2('0', { size: 120, fill: "#ffff00" }); LK.gui.topRight.addChild(self.scoreTxt); self.scoreTxt.anchor.set(1, 0); self.scoreTxt.x = 2048; self.scoreTxt.y = 0; LK.gui.topRight.score = 0; 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 = (i + 1) * (heart.width + 10) + 10; heart.y = 120; 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
@@ -171,13 +171,13 @@
self.scoreTxt = new Text2('0', {
size: 120,
fill: "#ffff00"
});
- LK.gui.topCenter.addChild(self.scoreTxt);
- self.scoreTxt.anchor.set(0.5, 0);
- self.scoreTxt.x = 2048 / 2;
+ LK.gui.topRight.addChild(self.scoreTxt);
+ self.scoreTxt.anchor.set(1, 0);
+ self.scoreTxt.x = 2048;
self.scoreTxt.y = 0;
- LK.gui.topCenter.score = 0;
+ LK.gui.topRight.score = 0;
self.incrementScoreAmount = 100;
var hearts = [];
self.loseHeart = function () {
if (hearts.length > 0) {
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.