User prompt
This should be the sequence of events: plant jumps, counts flies while in flight, adds to target score when it lands. Flies at the top should be worth 150, flies in the bottom 2/3 should be worth 100
User prompt
The score seem to go up forever once a fly is caught
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'y')' in this line: 'var scoreMultiplier = fly.y < 2732 / 3 ? 150 : 100;' Line Number: 142
User prompt
Fix Bug: 'ReferenceError: fly is not defined' in this line: 'var scoreMultiplier = fly.y < 2732 / 3 ? 150 : 100;' Line Number: 141
User prompt
In the top third of the screen should be worth 50 points more
User prompt
Hitting a bee should cancel the plant jump
User prompt
The score should only increment once the plant reaches the ground
User prompt
The flies caught in jump should only calculate when the plant gets to the ground.
User prompt
When the plant loses a heart it should flash for a full second. during that time it can't jump.
User prompt
The plant has three lives. It should only lose one life when hitting a bee.
User prompt
When the plant hits a bee, the plant should flash red and then return to the spawn point. It should lose 1 heart
User prompt
Every time a bee leaves the screen change its Y position and speed.
User prompt
The bee that appears from the left hould be flipped
User prompt
Now both bees are spawning from the left! One from the left, one from the right.
User prompt
have one of the bees appear on the left side and move to the right
User prompt
Both bees are appeariong from the same ide
User prompt
Make the bees 20% bigger
User prompt
Make sure the bee is always 1:1 scale
User prompt
now there are four bees again. there should be only 2
User prompt
Add two bees
User prompt
There hould only be two bees in total
User prompt
completely change the bee movement. one should appear from the left and one should appear from the right at random y positions.
User prompt
make the bees just scroll in from the sides
User prompt
the bees are popping in from the side instead of appearing seamlessly
User prompt
the bees seem stretched on the y axis
var Bee = Container.expand(function () { var self = Container.call(this); var beeGraphics = self.createAsset('bee', 'Bee Graphics', .5, .5); beeGraphics.scale.x = 1.5; beeGraphics.scale.y = 1; self.spawnBee = function () { self.x = Math.random() < 0.5 ? -100 : 2048 - 100; self.y = Math.random() * (2732 / 2); self.xSpeed = (Math.random() < 0.5 ? -1 : 1) * (Math.random() * 7 + 3); }; self.spawnBee(); 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) { beeGraphics.scale.x = 1; } else if (self.xSpeed < 0) { beeGraphics.scale.x = -1; } self.x += self.xSpeed; if (self.x > 2048 + 50 || self.x < -50) { 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.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.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; self.parent.incrementScore(self.parent.incrementScoreAmount); return true; } return false; }; }); var Game = Container.expand(function () { var self = Container.call(this); self.incrementScore = function (points) { var currentScore = LK.gui.topRight.score; var targetScore = currentScore + plant.fliesCaughtInJump * 100; var increment = function () { if (currentScore < targetScore) { currentScore += 5; self.scoreTxt.setText(currentScore); self.scoreShadowTxt.setText(currentScore); LK.setTimeout(increment, 10); } else { LK.gui.topRight.score = currentScore; } }; increment(); }; stage.on('down', function (obj) { if (!plant.isMoving) { 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" }); self.scoreShadowTxt = new Text2('0', { size: 120, fill: "#000000" }); self.scoreTxt.anchor.set(.5, 0); self.scoreShadowTxt.anchor.set(.5, 0); LK.gui.topRight.addChild(self.scoreShadowTxt); LK.gui.topRight.addChild(self.scoreTxt); self.scoreTxt.x -= 240; self.scoreShadowTxt.x = self.scoreTxt.x + 5; self.scoreShadowTxt.y = self.scoreTxt.y + 5; LK.gui.topRight.score = 0; self.incrementScoreAmount = 100; var hearts = []; 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 = []; for (var i = 0; i < 2; i++) { var bee = new Bee(); bees.push(bee); self.addChild(bee); } 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 (isGameOver) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } }); });
var Bee = Container.expand(function () {
var self = Container.call(this);
var beeGraphics = self.createAsset('bee', 'Bee Graphics', .5, .5);
beeGraphics.scale.x = 1.5;
beeGraphics.scale.y = 1;
self.spawnBee = function () {
self.x = Math.random() < 0.5 ? -100 : 2048 - 100;
self.y = Math.random() * (2732 / 2);
self.xSpeed = (Math.random() < 0.5 ? -1 : 1) * (Math.random() * 7 + 3);
};
self.spawnBee();
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) {
beeGraphics.scale.x = 1;
} else if (self.xSpeed < 0) {
beeGraphics.scale.x = -1;
}
self.x += self.xSpeed;
if (self.x > 2048 + 50 || self.x < -50) {
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.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.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;
self.parent.incrementScore(self.parent.incrementScoreAmount);
return true;
}
return false;
};
});
var Game = Container.expand(function () {
var self = Container.call(this);
self.incrementScore = function (points) {
var currentScore = LK.gui.topRight.score;
var targetScore = currentScore + plant.fliesCaughtInJump * 100;
var increment = function () {
if (currentScore < targetScore) {
currentScore += 5;
self.scoreTxt.setText(currentScore);
self.scoreShadowTxt.setText(currentScore);
LK.setTimeout(increment, 10);
} else {
LK.gui.topRight.score = currentScore;
}
};
increment();
};
stage.on('down', function (obj) {
if (!plant.isMoving) {
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"
});
self.scoreShadowTxt = new Text2('0', {
size: 120,
fill: "#000000"
});
self.scoreTxt.anchor.set(.5, 0);
self.scoreShadowTxt.anchor.set(.5, 0);
LK.gui.topRight.addChild(self.scoreShadowTxt);
LK.gui.topRight.addChild(self.scoreTxt);
self.scoreTxt.x -= 240;
self.scoreShadowTxt.x = self.scoreTxt.x + 5;
self.scoreShadowTxt.y = self.scoreTxt.y + 5;
LK.gui.topRight.score = 0;
self.incrementScoreAmount = 100;
var hearts = [];
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 = [];
for (var i = 0; i < 2; i++) {
var bee = new Bee();
bees.push(bee);
self.addChild(bee);
}
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 (isGameOver) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
});
});
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.