Code edit (2 edits merged)
Please save this source code
User prompt
when bee hits a flower, it should orbit the flower
User prompt
when bee hits a flower set beejumping false
User prompt
when bee hits a flower, it inherits the flowers rotation relative to flower center
Code edit (1 edits merged)
Please save this source code
User prompt
bees jump direction should be its local up direction
Code edit (2 edits merged)
Please save this source code
User prompt
on stage down, set beejumping true
User prompt
bee's movement should happen in its update function if beejumping is true
User prompt
bee should not have gravity
User prompt
Fix Bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'jump')' in this line: 'self.jump = function () {};' Line Number: 3
User prompt
Fix Bug: 'TypeError: bee.jump is not a function' in this line: 'bee.jump();' Line Number: 87
User prompt
once jumping, bee continue until it hits a flower or goes off stage
User prompt
on stage down bee jumps
User prompt
on tap, make bee jump in it's local up direction
User prompt
scale flowers randomly on spawn between 2 and 4
User prompt
set each flower's graphics randomly to one of the created eight assets
Code edit (1 edits merged)
Please save this source code
User prompt
start position for bee should accounf for its scale and height
User prompt
move bee up
User prompt
scale bee 2
User prompt
all 8 flowertypes should be in the asset section from start
User prompt
flower can have one of 8 different graphics
Code edit (1 edits merged)
Please save this source code
User prompt
the lowest flower should be directly above player on x axis
var MAX_ROTATION_SPEED = 0.01; var Bee = Container.expand(function () { var self = Container.call(this); var beeGraphics = self.createAsset('bee', 'Bee character', .5, .5); beeGraphics.scale.set(2); self.speed = 5; self.jump = function () { self.y -= self.speed; }; self.collectNectar = function () {}; self.update = function () {}; Object.defineProperty(self, 'height', { get: function () { return beeGraphics.height; } }); }); var Flower = Container.expand(function () { var self = Container.call(this); var flowerType = Math.floor(Math.random() * 8) + 1; var flowerGraphics = self.createAsset('flower' + flowerType, 'Flower Type ' + flowerType, .5, .5); var randomScale = Math.random() * 2 + 2; flowerGraphics.scale.set(randomScale); self.addChild(flowerGraphics); for (var i = 1; i <= 8; i++) { LK.getAsset('flower' + i, 'Flower Type ' + i, .5, .5); } self.rotationStep = (Math.random() < 0.5 ? -1 : 1) * MAX_ROTATION_SPEED; self.produceNectar = function () {}; self.update = function () { self.rotation += self.rotationStep; }; }); var Nectar = Container.expand(function () { var self = Container.call(this); var nectarGraphics = self.createAsset('nectar', 'Nectar', .5, .5); }); var Game = Container.expand(function () { var self = Container.call(this); var bee = self.addChild(new Bee()); var flowers = [self.addChild(new Flower()), self.addChild(new Flower()), self.addChild(new Flower())]; flowers[0].y = 400; flowers[1].y = 1100; flowers[2].y = 1800; flowers[0].x = 904; flowers[1].x = 1200; flowers[2].x = 1024; flowers.forEach(function (flower, index) { flower.y += flower.height / 2; }); var nectars = []; var scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); LK.gui.topCenter.addChild(scoreTxt); var isGameOver = false; bee.x = 1024; bee.y = 2732 - bee.height - 100; LK.on('tick', function () { bee.update(); if (isGameOver) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } for (var i = 0; i < flowers.length; i++) { flowers[i].produceNectar(); flowers[i].update(); } for (var j = 0; j < nectars.length; j++) { if (bee.intersects(nectars[j])) { bee.collectNectar(); nectars[j].destroy(); nectars.splice(j, 1); } } }); stage.on('down', function (obj) { var event = obj.event; var pos = event.getLocalPosition(self); if (bee.intersects(pos)) { bee.jump(); } }); });
===================================================================
--- original.js
+++ change.js
@@ -18,8 +18,10 @@
var Flower = Container.expand(function () {
var self = Container.call(this);
var flowerType = Math.floor(Math.random() * 8) + 1;
var flowerGraphics = self.createAsset('flower' + flowerType, 'Flower Type ' + flowerType, .5, .5);
+ var randomScale = Math.random() * 2 + 2;
+ flowerGraphics.scale.set(randomScale);
self.addChild(flowerGraphics);
for (var i = 1; i <= 8; i++) {
LK.getAsset('flower' + i, 'Flower Type ' + i, .5, .5);
}
A large red round flower. Top down view. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A large blue round flower. Top down view. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A round yellow flower. Top down view. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A round purple and red flower. Top down view. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A round green and yellow flower. Top down view. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A round orange and white flower. Top down view. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A round cyan and blue flower. Top down view. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A round magenta and green flower. Top down view. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A happy little bee. Top down view. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a lush meadow full of tiny flowers. top-down view. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
yellow pointy star twinkle. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.