User prompt
Fix Bug: 'ReferenceError: Can't find variable: plant' in this line: 'self.y = 2732 - plant.height / 2;' Line Number: 36
User prompt
Fix Bug: 'ReferenceError: Can't find variable: plant' in this line: 'self.y = 2732 - plant.height / 2;' Line Number: 36
User prompt
The plant should start at the bottom middle of the screen and then move to where the player taps and then return to the bottom middle
User prompt
The plant should move transition to the place the player tapped and then come back
User prompt
The tap point should be a target that the plant moves towards. It should take 1 second to get to the point and then return
User prompt
When the player taps the screen launch the plant at that point
User prompt
Spawn a fly every 2 seconds, there should be a maximum of 5 flies on screen at once
User prompt
The fly speed should be from -10 to 10 and never 0
User prompt
If the fly xSpeed is negative the sprite should be flipped, if it is positive it should be normal
User prompt
Spawn a fly every 2 seconds
User prompt
The fly gets stuck in the middle and keeps flipping. It should only be allowed to change direction once.
User prompt
Use an xSpeed variable. Set it to random between -5 and 5. If it is negative spawn the fly on the right edge of the screen. If it is positive spawn the fly on the left edge. When the fly hits the middle of the screen multiply the speed by -1. When it returns to the edge destroy it.
User prompt
Make a variable that tracks which side the fly came from, left or right. Then when the fly gets to the middle change the variable so it goes back the way it came.
User prompt
The fly should appear from either side of the screen, fly to close to the middle of the screen, turn around and then fly back to the side it spawned from
User prompt
Change that code so it flies back in the direction it came
User prompt
Have the fly sprite flip and then return to the edge of the screen
User prompt
Make the flies come on screen one at a time, fly to just past the middle of the screen and then return to the edge they came from
User prompt
Make the flies move back and forth at random rates
User prompt
Make the background sky blue
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'flies[a].move')' in this line: 'flies[a].move();' Line Number: 33
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'flies[a].move')' in this line: 'flies[a].move();' Line Number: 33
Initial prompt
Snapdragon
var Fly = Container.expand(function () { var self = Container.call(this); var flyGraphics = self.createAsset('fly', 'Fly Graphics', .5, .5); self.speed = 5; self.move = function () { if (self.x < 2048 / 2) { self.x += self.speed; } else if (self.x > 2048 / 2) { self.x = -50; self.y = Math.random() * (2732 - self.height); flyGraphics.scale.x *= -1; } }; }); var Plant = Container.expand(function () { var self = Container.call(this); var plantGraphics = self.createAsset('plant', 'Plant Graphics', .5, .5); self.catchFly = function (fly) { if (self.intersects(fly)) { fly.destroy(); } }; }); var Game = Container.expand(function () { var self = Container.call(this); LK.stageContainer.setBackgroundColor(0x87CEEB); var flies = []; var plant = self.addChild(new Plant()); plant.x = 2048 / 2; plant.y = 2732 - plant.height; var scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); scoreTxt.anchor.set(.5, 0); LK.gui.topCenter.addChild(scoreTxt); var isGameOver = false; 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); } } } if (flies.length == 0) { var newFly = new Fly(); newFly.x = -50; newFly.y = Math.random() * (2732 - newFly.height); flies.push(newFly); self.addChild(newFly); } for (var a = flies.length; a >= 0; a--) { plant.catchFly(flies[a]); } if (isGameOver) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } }); });
===================================================================
--- original.js
+++ change.js
@@ -5,9 +5,11 @@
self.move = function () {
if (self.x < 2048 / 2) {
self.x += self.speed;
} else if (self.x > 2048 / 2) {
- self.x -= self.speed;
+ self.x = -50;
+ self.y = Math.random() * (2732 - self.height);
+ flyGraphics.scale.x *= -1;
}
};
});
var Plant = Container.expand(function () {
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.