Code edit (1 edits merged)
Please save this source code
User prompt
For each tick of the countdown, create a new text element rather than reusing the existing one. This makes the stroke keep working.
Code edit (1 edits merged)
Please save this source code
User prompt
Remove the text that shows volume.
User prompt
Add a black outline to the countdownText label
Code edit (10 edits merged)
Please save this source code
User prompt
Add a new countdown class that shows a big 5,4,3,2,1 label on the screen. Top Center
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (3 edits merged)
Please save this source code
User prompt
create a new class for speech bubbles with the asset type small_bork_speach. These should fade out and destroy themself over time, while slowly moving up ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
Code edit (12 edits merged)
Please save this source code
User prompt
Add the chicken bork the same place small_bork is placed
Code edit (7 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: Can't find variable: scaleY' in or related to this line: 'scaleY.y = 1.5;' Line Number: 68
Code edit (1 edits merged)
Please save this source code
Code edit (23 edits merged)
Please save this source code
User prompt
When chicken lands use a tween to make the chicken bounce scale y ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
Turn the particles container into a full class
Code edit (11 edits merged)
Please save this source code
User prompt
Create a dirt particle element that fades over time.
User prompt
When the chicken moves, spawn dirt particle at the bottom center of the chicken
/**** * Plugins ****/ var facekit = LK.import("@upit/facekit.v1"); var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ //<Write imports for supported plugins here> // Chicken class to represent the player character var Chicken = Container.expand(function () { var self = Container.call(this); var chickenGraphics = self.attachAsset('chicken', { anchorX: 0.5, anchorY: 1 }); // Add a collision element inside the chicken var collisionElement = self.attachAsset('collisionElement', { anchorX: 0.5, anchorY: 0.5, width: chickenGraphics.width * 0.4, height: chickenGraphics.height * 0.2 }); collisionElement.alpha = 0; collisionElement.y = -90; chickenGraphics.y = 90; self.speed = 5; self.jumpHeight = 400; self.isJumping = true; self.jumpVelocity = 0; self.update = function () { self.y += self.jumpVelocity; self.jumpVelocity += 1; // Gravity effect if (self.jumpVelocity > 30) { self.jumpVelocity = 30; } var targetPlatform = undefined; var isOnPlatform = platforms.some(function (platform) { if (collisionElement.intersects(platform)) { if (self.y - platform.y < 100) { targetPlatform = platform; return true; } } }); if (isOnPlatform && self.jumpVelocity > 0) { // Ground level self.y = targetPlatform.y + 70; if (self.isJumping) { for (var a = 0; a < 30; a++) { particles.addDirtParticle(chicken.x, chicken.y); } chickenGraphics.scale.y = .8; chickenGraphics.scale.x = 1.2; tween(chickenGraphics, { scaleY: 1, scaleX: 1 }, { duration: 1000, easing: tween.elasticOut }); } self.isJumping = false; self.jumpVelocity = 0; // Reset jump velocity when hitting the ground // Apply a bounce effect using tween when the chicken lands } self.x = 2048 / 2; // Center the chicken horizontally }; function groove() { tween(self, { scaleX: 1.03, scaleY: 1.03 }, { duration: 300, onFinish: function onFinish() { tween(self, { scaleX: 1, scaleY: 1 }, { onFinish: groove, duration: 300 }); } }); } groove(); self.jump = function (volume) { if (platforms[0].x > -1500) { return; } var isOnPlatform = platforms.some(function (platform) { if (collisionElement.intersects(platform)) { return self.y - platform.y < 100; } }); if (!self.isJumping && isOnPlatform) { self.isJumping = true; for (var a = 0; a < 30; a++) { particles.addDirtParticle(chicken.x, chicken.y); } chicken.jumpVelocity = -45 * volume; // Set jump velocity based on volume self.update(); } }; }); var Countdown = Container.expand(function () { var self = Container.call(this); var currentNumber = 5; var countdownText; var countdownInterval = LK.setInterval(function () { if (countdownText) { countdownText.destroy(); } countdownText = new Text2(currentNumber.toString(), { size: 300, fill: 0xFFFFFF, weight: 800, stroke: 0x000000, // Add black outline strokeThickness: 20 // Set thickness of the outline }); countdownText.anchor.set(0.5, 0.5); self.addChild(countdownText); countdownText.x = 2048 / 2; countdownText.y = 200; currentNumber--; if (currentNumber <= 0) { self.destroy(); LK.clearInterval(countdownInterval); } }, 1000); }); // DirtParticle class to represent a fading dirt particle var DirtParticle = Container.expand(function () { var self = Container.call(this); var dirtGraphics = self.attachAsset('dirtparticle', { anchorX: 0.5, anchorY: 1 }); var speed = Math.random() * 3; var angle = -Math.random() * Math.PI; var scale = 1; // Update function to handle fading self.update = function () { scale -= 0.02; // Reduce alpha to fade out self.scale.set(scale, scale); if (scale <= 0) { self.destroy(); // Remove particle when fully transparent } self.x += Math.cos(angle) * speed; self.y += Math.sin(angle) * speed; }; }); // LargeBork class to represent the large bork overlay var LargeBork = Container.expand(function () { var self = Container.call(this); self.moveMultiplier = 0; self.moveSpeed = -5; // Base move speed var largeBorkGraphicsChicken = self.attachAsset('chicken_shout', { anchorX: 0.5, anchorY: 1 }); largeBorkGraphicsChicken.y = -50; var largeBorkGraphics = self.attachAsset('large_bork', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { self.moveMultiplier = xspeed * 6; self.x += self.moveSpeed * self.moveMultiplier; }; self.bork = function () { var speechBubbleLarge = new SpeechBubbleLarge(); var offset = Math.PI / 4 * Math.random() - Math.PI / 2 - Math.PI / 4; speechBubbleLarge.x = -50 + Math.cos(offset) * 350; speechBubbleLarge.y = -100 + Math.sin(offset) * 350; speechBubbleLarge.rotation = offset + Math.PI * 0.5 + .3; self.addChild(speechBubbleLarge); largeBorkGraphicsChicken.scale.y = 1.05; largeBorkGraphicsChicken.scale.x = 1.05; largeBorkGraphicsChicken.rotation = .2; tween(largeBorkGraphicsChicken, { scaleY: 1, scaleX: 1, rotation: 0 }, { duration: 1000, easing: tween.elasticOut }); }; }); // Particles class to manage dirt particles var Particles = Container.expand(function () { var self = Container.call(this); // Method to add a dirt particle at a specific position self.moveMultiplier = 0; self.moveSpeed = -5; // Base move speed self.addDirtParticle = function (x, y) { var dirtParticle = new DirtParticle(); dirtParticle.x = x - self.x + Math.random() * 130 - 40; dirtParticle.y = y + 90; self.addChild(dirtParticle); }; self.update = function () { self.moveMultiplier = xspeed * 6; self.x += self.moveSpeed * self.moveMultiplier; }; }); // Platform class to represent moving platforms var Platform = Container.expand(function () { var self = Container.call(this); self.moveSpeed = -5; // Base move speed self.moveMultiplier = 1; // Default move multiplier var groundGraphics = self.attachAsset('ground', { anchorX: 0, anchorY: 0 }); self.width = groundGraphics.width; self.update = function () { self.moveMultiplier = xspeed * 6; self.x += self.moveSpeed * self.moveMultiplier; // If the platform moves off screen to the left, reposition it to the right /*if (self.x < -self.width) { // Reposition the platform to the right with a random gap self.x += self.width + 2048 + Math.random() * 1000; }*/ }; }); var SpeechBubble = Container.expand(function () { var self = Container.call(this); var bubbleGraphics = self.attachAsset('small_bork_speach', { anchorX: 0.8, anchorY: 1 }); // Initial position and scale self.y -= 50; self.alpha = 1; // Update function to handle fading and moving up self.update = function () { self.y -= 1; // Move up self.alpha -= 0.01; // Fade out if (self.alpha <= 0) { self.destroy(); // Remove bubble when fully transparent } }; // Apply a tween for smooth fading tween(self, { alpha: 0 }, { duration: 2000, easing: tween.linear, onFinish: function onFinish() { self.destroy(); } }); }); var SpeechBubbleLarge = Container.expand(function () { var self = Container.call(this); var bubbleGraphics = self.attachAsset('large_bork_speach', { anchorX: 0.2, anchorY: 1 }); // Initial position and scale self.y -= 50; self.alpha = 1; // Update function to handle fading and moving up self.scale.set(0, 0); tween(self, { scaleX: 1, scaleY: 1 }, { duration: 800, easing: tween.elasticOut }); // Apply a tween for smooth fading LK.setTimeout(function () { tween(self, { alpha: 0, y: self.y - 100 }, { duration: 100, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); } }); }, 800); }); // Spikes class to represent dangerous spikes var Spikes = Container.expand(function () { var self = Container.call(this); self.moveMultiplier = 0; self.moveSpeed = -5; // Base move speed var spikesGraphics = self.attachAsset('spikes', { anchorX: 0, anchorY: 0 }); self.update = function () { self.moveMultiplier = xspeed * 6; self.x += self.moveSpeed * self.moveMultiplier; }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ var countdown = game.addChild(new Countdown()); // Initialize platforms function addPlatformAt(x, y) { var platform = game.addChild(new Platform()); platform.x = x; //i * 1900 + i * Math.random() * 1000; // Space platforms with gaps platform.y = y; //2200; // Ground level platforms.push(platform); return platform; } var xspeed = 0; var platforms = []; addPlatformAt(1000, 2200); addPlatformAt(2450, 2200); addPlatformAt(3000 + 1500, 2200); var platform3 = addPlatformAt(5000 + 1500, 1800); var spikes = game.addChild(new Spikes()); spikes.x = platform3.x; spikes.y = platform3.y - 900; // position spikes above the platform addPlatformAt(7000 + 1500, 2200); var platform1 = platforms[0]; var smallBork = platform1.attachAsset('small_bork', { anchorX: 0.5, anchorY: 0.5, x: platform1.width / 2 - 500, y: -550 }); var chickenBork = platform1.attachAsset('chicken_bork', { anchorX: 0.5, anchorY: 1, x: smallBork.x - 50, y: -700 }); var platform2 = platforms[1]; var largeBork = game.addChild(new LargeBork()); largeBork.x = platform2.x + platform2.width + 250; largeBork.y = platform2.y - 500; var startFlag = platform2.attachAsset('start', { anchorX: 0.5, anchorY: 0.5, x: 130, y: -140 }); var lastPlatform = addPlatformAt(9000 + 1500, 1500); var trophy = lastPlatform.attachAsset('trophy', { anchorX: 0.5, anchorY: 0.5, x: lastPlatform.width / 2, y: -100 }); function doSmallBork() { var speechBubble = new SpeechBubble(); var offset = Math.PI / 2 * Math.random() - Math.PI / 2 - Math.PI / 4; speechBubble.x = smallBork.x - 50 + Math.cos(offset) * 150; speechBubble.y = smallBork.y - 150 + Math.sin(offset) * 150; speechBubble.rotation = offset + Math.PI * 0.5 + .3; platform1.addChild(speechBubble); LK.setTimeout(doSmallBork, 200 + Math.random() * 800); chickenBork.scale.y = 1.05; chickenBork.scale.x = 1.05; tween(chickenBork, { scaleY: 1, scaleX: 1 }, { duration: 1000, easing: tween.elasticOut }); largeBork.bork(); } doSmallBork(); // Initialize chicken //<Write imports for supported plugins here> var chicken = game.addChild(new Chicken()); var particles = game.addChild(new Particles()); Platform.prototype.chicken = chicken; // Make chicken accessible in Platform class chicken.x = 2048 / 2; // Center the chicken horizontally chicken.y = 2200; // Start the chicken at the ground level // Update game logic game.update = function () { // Remove excess platforms if more than 3 exist /*while (platforms.length > 3) { var excessPlatform = platforms.shift(); excessPlatform.destroy(); }*/ // Create and add a dirt particle at the chicken's position if (!chicken.isJumping) { if (facekit.volume > 0.5) { xspeed += facekit.volume; particles.addDirtParticle(chicken.x, chicken.y); } xspeed *= .4; } if (facekit.volume > 0.80 && !chicken.isJumping) { chicken.jump(facekit.volume); } // Check if the chicken has fallen off the screen if (chicken.y > 3000) { // End the game if the chicken has fallen off the screen LK.effects.flashScreen(0xff0000, 3000); // Flash screen red for 1 second (1000ms) to show we are dead. LK.showGameOver(); } // Check if the chicken touches the spikes if (chicken.intersects(spikes)) { // End the game if the chicken touches the spikes LK.effects.flashScreen(0xff0000, 3000); // Flash screen red for 1 second (1000ms) to show we are dead. LK.showGameOver(); } // Check if the chicken touches the trophy if (chicken.intersects(trophy)) { // End the game with a win if the chicken touches the trophy LK.showYouWin(); } };
===================================================================
--- original.js
+++ change.js
@@ -106,10 +106,14 @@
});
var Countdown = Container.expand(function () {
var self = Container.call(this);
var currentNumber = 5;
+ var countdownText;
var countdownInterval = LK.setInterval(function () {
- var countdownText = new Text2(currentNumber.toString(), {
+ if (countdownText) {
+ countdownText.destroy();
+ }
+ countdownText = new Text2(currentNumber.toString(), {
size: 300,
fill: 0xFFFFFF,
weight: 800,
stroke: 0x000000,
Golden chicken trophy. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Row of Spikes. Computer Game Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A simple wide hand-drawn symmetrical ribbon banners. The banner text reads “Small bawk to move” in playful, cartoonish black lettering. The ribbon is warm beige parchment. Each side ends with simple curved, scroll-like ribbon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A simple wide hand-drawn symmetrical ribbon banners. The banner text reads “Big BAWK to Jump!” in playful, cartoonish black lettering. The ribbon is warm beige parchment. Each side ends with simple curved, scroll-like ribbon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Cartoon-style rectangular speech bubble with a sharp, dynamic outline. Inside the bubble, create the text ‘BAWK’ in bold, vibrant orange-to-yellow gradient lettering, with a thick black jagged shadow for contrast. The text should have a dynamic comic-style font and appear slightly 3D. The bubble should have a sharp tail pointing downward, consistent with comic-style speech bubbles. The intent is that we are shouting "BAWK".. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Simple cartoon whisper speech bubble with text "bawk" lowercase lettering. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows