User prompt
Give the red panda a superpower.
User prompt
Add Music1 to the game.
User prompt
Add a new moon object to the wallpapper.
User prompt
Add Owl1 Sounds to the game.
User prompt
Add Music1 to the game.
User prompt
Add Music1 to the game.
User prompt
Add Music1 to the game.
User prompt
Add Music1 to the game.
User prompt
Add to the black wallpapper a moonlight.
User prompt
Change the blue colour background to black colour.
User prompt
change the wallappper to night sky
User prompt
Change the wallpapper from black to halloween
Initial prompt
Red panda feeding time
/**** * Classes ****/ // Apple class var Apple = Container.expand(function () { var self = Container.call(this); var appleGraphics = self.attachAsset('apple', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; self.update = function () { self.y += self.speed; if (self.y > 2732) { self.destroy(); } }; }); // Pumpkin class var Pumpkin = Container.expand(function () { var self = Container.call(this); var pumpkinGraphics = self.attachAsset('pumpkin', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; self.update = function () { self.y += self.speed; if (self.y > 2732) { self.destroy(); } }; }); // Assets will be automatically created and loaded during gameplay // Red Panda class var RedPanda = Container.expand(function () { var self = Container.call(this); var pandaGraphics = self.attachAsset('redPanda', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Red Panda update logic if needed }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background color }); /**** * Game Code ****/ var moonlight = LK.getAsset('moonlight', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 500 }); game.addChild(moonlight); LK.playMusic('Music1'); var redPanda = game.addChild(new RedPanda()); redPanda.x = 2048 / 2; redPanda.y = 2500; var scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); var score = 0; var apples = []; var pumpkins = []; var dragNode = null; function handleMove(x, y, obj) { if (dragNode) { dragNode.x = x; dragNode.y = y; } } game.down = function (x, y, obj) { dragNode = redPanda; handleMove(x, y, obj); }; game.up = function (x, y, obj) { dragNode = null; }; game.move = handleMove; game.update = function () { for (var i = apples.length - 1; i >= 0; i--) { if (apples[i].intersects(redPanda)) { score += 1; scoreTxt.setText(score); apples[i].destroy(); apples.splice(i, 1); } } for (var j = pumpkins.length - 1; j >= 0; j--) { if (pumpkins[j].intersects(redPanda)) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } } if (LK.ticks % 60 == 0) { var newApple = new Apple(); newApple.x = Math.random() * 2048; newApple.y = -50; apples.push(newApple); game.addChild(newApple); } if (LK.ticks % 120 == 0) { var newPumpkin = new Pumpkin(); newPumpkin.x = Math.random() * 2048; newPumpkin.y = -50; pumpkins.push(newPumpkin); game.addChild(newPumpkin); } };
===================================================================
--- original.js
+++ change.js
@@ -60,8 +60,9 @@
x: 2048 / 2,
y: 500
});
game.addChild(moonlight);
+LK.playMusic('Music1');
var redPanda = game.addChild(new RedPanda());
redPanda.x = 2048 / 2;
redPanda.y = 2500;
var scoreTxt = new Text2('0', {