User prompt
Please fix the bug: 'TypeError: LK.Line is not a constructor' in or related to this line: 'var line = new LK.Line({' Line Number: 407
User prompt
Trace a path for chicken to run
User prompt
Reset launches when player reaches 1000
User prompt
Increase swipe sensitivity to be able to direct the chicken
User prompt
Increase the bounce trajectory so one swipe can bounce of rope 5 times
User prompt
Give player 15 launches
User prompt
Remove all launch resets
User prompt
Make chicken bounce off ropes more time
User prompt
Add more popcorn
User prompt
You only get a launch reset once when you pass level 1, once when you pass level 2, once when you pass level 3
User prompt
You get one launch reset per every level
User prompt
Level 1 is between 0 - 200 points, level 2 is between 200 - 500 points, level 3 is between 500 - 1000 points, level 4 is between 1000 - 2000 points, level 5 is between 2000 - 4000 points you win the game if you reach 5000 points
User prompt
Launches reset at over 200 points, over 500 points and over 1000 points
User prompt
Launches reset at 200+ points, 500+ points and 1000+ points
User prompt
Create more bounce with less chaotic movement
User prompt
Launches only reset at 200 pts, 500pts and 1000 pts
User prompt
Aim chicken with directions of swipe
User prompt
Remove launcher
User prompt
Remove aim line
User prompt
Decrease speed of chicken and create better trajectory bounce effect ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Launches reset at 200 points then 500 points, then 1000 points
User prompt
Decrease speed
User prompt
Change background colour to black
User prompt
Make the ropes extremely bouncy so chicken bounces all around
User prompt
Change dynamics so you can swipe chicken instead of sling
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var ChickenJockey = Container.expand(function () { var self = Container.call(this); // Create and attach chicken asset var chickenGraphics = self.attachAsset('chicken', { anchorX: 0.5, anchorY: 0.5 }); // Physics properties self.vx = 0; self.vy = 0; self.gravity = 0.5; self.bounceDecay = 0.9; // Slightly more energy loss per bounce for better control self.friction = 0.995; // Reduced horizontal friction self.launched = false; self.bounceCount = 0; self.maxBounces = 30; // Allow more bounces before stopping // Rotation properties self.rotationSpeed = 0; self.launch = function (power, angle) { // Convert angle to radians var radians = angle * Math.PI / 180; // Set initial velocity based on power and angle self.vx = Math.cos(radians) * power; self.vy = Math.sin(radians) * power; // Set rotation speed based on velocity self.rotationSpeed = power / 50; self.launched = true; self.bounceCount = 0; // Play launch sound LK.getSound('launch').play(); }; self.reset = function () { self.vx = 0; self.vy = 0; self.rotation = 0; self.rotationSpeed = 0; self.launched = false; self.bounceCount = 0; }; self.update = function () { if (!self.launched) { return; } // Apply physics self.vy += self.gravity; self.x += self.vx; self.y += self.vy; self.vx *= self.friction; // Apply rotation self.rotation += self.rotationSpeed; // Check if stopped if (Math.abs(self.vx) < 0.5 && Math.abs(self.vy) < 0.5 && self.bounceCount > 0) { self.launched = false; // Notify game that chicken jockey has stopped if (typeof game.onChickenJockeyStop === 'function') { game.onChickenJockeyStop(); } } // Check if max bounces reached if (self.bounceCount >= self.maxBounces) { self.launched = false; // Notify game that max bounces reached if (typeof game.onMaxBouncesReached === 'function') { game.onMaxBouncesReached(); } } }; return self; }); var Launcher = Container.expand(function () { var self = Container.call(this); // Create and attach launcher asset var launcherGraphics = self.attachAsset('launcher', { anchorX: 0.5, anchorY: 0.5 }); // Swipe direction indicator (replaces aim line) var aimLine = self.attachAsset('aimLine', { anchorX: 0.5, anchorY: 0.5, alpha: 0 }); // Launcher properties self.angle = -45; // Starting angle in degrees self.power = 20; // Starting power self.maxPower = 60; // Higher maximum power for more forceful launches self.aiming = false; self.startX = 0; self.startY = 0; self.swipeStartTime = 0; self.startAim = function (x, y) { self.aiming = true; self.startX = x; self.startY = y; self.swipeStartTime = Date.now(); aimLine.x = 0; aimLine.y = 0; aimLine.width = 0; aimLine.alpha = 0.7; }; self.updateAim = function (x, y) { if (!self.aiming) { return; } // Calculate swipe direction var dx = x - self.startX; var dy = y - self.startY; // Calculate angle in degrees (0 is right, 90 is up) self.angle = Math.atan2(dy, dx) * 180 / Math.PI; // Allow full 360 degree rotation if (self.angle < 0) { self.angle += 360; } // Calculate swipe distance for power var distance = Math.sqrt(dx * dx + dy * dy); // Show swipe direction indicator aimLine.rotation = Math.atan2(dy, dx); aimLine.width = Math.min(distance, 300); // Calculate power based on swipe speed and distance var swipeTime = Math.max(Date.now() - self.swipeStartTime, 100); self.power = Math.min(distance / swipeTime * 100, self.maxPower); // Reduced power multiplier }; self.endAim = function () { self.aiming = false; aimLine.alpha = 0; // Calculate final swipe speed var swipeTime = Math.max(Date.now() - self.swipeStartTime, 100); // Return launch parameters return { angle: self.angle, power: self.power }; }; return self; }); var Popcorn = Container.expand(function () { var self = Container.call(this); // Create and attach popcorn asset var popcornGraphics = self.attachAsset('popcorn', { anchorX: 0.5, anchorY: 0.5 }); // Add slight animation self.animationOffset = Math.random() * Math.PI * 2; self.animationSpeed = 0.03 + Math.random() * 0.02; self.baseY = 0; self.collect = function () { // Play collect sound LK.getSound('collect').play(); // Flash effect LK.effects.flashObject(self, 0xFFFFFF, 200); // Animate collection (flying up) tween(self, { y: self.y - 100, alpha: 0 }, { duration: 500, easing: tween.easeOut, onFinish: function onFinish() { // Remove from parent if (self.parent) { self.parent.removeChild(self); } } }); }; self.update = function () { // Hover animation if (self.baseY === 0) { self.baseY = self.y; } self.y = self.baseY + Math.sin(LK.ticks * self.animationSpeed + self.animationOffset) * 5; }; return self; }); var Rope = Container.expand(function () { var self = Container.call(this); // Create and attach rope asset var ropeGraphics = self.attachAsset('rope', { anchorX: 0.5, anchorY: 0.5 }); // Rope properties self.tension = 4.0; // Slightly higher tension self.bounce = function (chickenJockey) { // Calculate new velocity based on collision angle and rope tension var normalAngle = Math.atan2(chickenJockey.y - self.y, chickenJockey.x - self.x); // Angle from rope to chicken // Calculate new velocity based on angle and tension var speed = Math.sqrt(chickenJockey.vx * chickenJockey.vx + chickenJockey.vy * chickenJockey.vy); var bounceAngle = 2 * normalAngle - Math.atan2(chickenJockey.vy, chickenJockey.vx); // Angle of reflection chickenJockey.vx = speed * Math.cos(bounceAngle) * chickenJockey.bounceDecay * self.tension; chickenJockey.vy = speed * Math.sin(bounceAngle) * chickenJockey.bounceDecay * self.tension; // Increment bounce count chickenJockey.bounceCount++; // Play bounce sound LK.getSound('bounce').play(); // Flash rope to indicate bounce LK.effects.flashObject(self, 0xFFFFFF, 200); }; self.intersectsWithPoint = function (x, y) { var halfWidth = ropeGraphics.width / 2; var halfHeight = ropeGraphics.height / 2; // Check if point is within the rope's bounding box return x >= self.x - halfWidth && x <= self.x + halfWidth && y >= self.y - halfHeight && y <= self.y + halfHeight; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 // Black background }); /**** * Game Code ****/ // Game state var gameState = "ready"; // ready, aiming, launched, gameOver var score = 0; var launches = 0; var maxLaunches = 5; var popcorns = []; var ropes = []; // Create wrestling arena var arena = game.addChild(LK.getAsset('arena', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 })); // Create chicken jockey var chickenJockey = game.addChild(new ChickenJockey()); var launcher = game.addChild(new Launcher()); // Game boundaries var bounds = { left: arena.x - arena.width / 2, right: arena.x + arena.width / 2, top: arena.y - arena.height / 2, bottom: arena.y + arena.height / 2 }; // Create GUI elements var scoreText = new Text2("Score: 0", { size: 70, fill: 0xFFFFFF }); scoreText.anchor.set(0.5, 0); LK.gui.top.addChild(scoreText); var launchesText = new Text2("Launches: 0/" + maxLaunches, { size: 50, fill: 0xFFFFFF }); launchesText.anchor.set(0, 0); launchesText.x = 120; // Avoid top-left corner launchesText.y = 20; LK.gui.topLeft.addChild(launchesText); var instructionText = new Text2("Drag to aim and launch the chicken!", { size: 40, fill: 0xFFFFFF }); instructionText.anchor.set(0.5, 0); instructionText.y = 100; LK.gui.top.addChild(instructionText); // Initialize game function initGame() { // Reset variables score = 0; launches = 0; gameState = "ready"; // Update UI scoreText.setText("Score: " + score); launchesText.setText("Launches: " + launches + "/" + maxLaunches); instructionText.setText("Swipe to launch the chicken!"); // Reset chicken jockey resetChickenJockey(); // Clear existing popcorn and ropes clearPopcornsAndRopes(); // Create ropes around the arena createRopes(); // Create popcorn scattered around the arena createPopcorn(15); // Play background music LK.playMusic('gameMusic'); } function resetChickenJockey() { chickenJockey.reset(); // Position chicken in the center of the arena chickenJockey.x = arena.x; chickenJockey.y = arena.y; // Position launcher at the same position launcher.x = chickenJockey.x; launcher.y = chickenJockey.y; launcher.rotation = -Math.PI / 4; // 45 degrees upward } function clearPopcornsAndRopes() { // Remove all popcorn for (var i = 0; i < popcorns.length; i++) { if (popcorns[i].parent) { popcorns[i].parent.removeChild(popcorns[i]); } } popcorns = []; // Remove all ropes for (var i = 0; i < ropes.length; i++) { if (ropes[i].parent) { ropes[i].parent.removeChild(ropes[i]); } } ropes = []; } function createRopes() { // Create top rope var topRope = new Rope(); topRope.x = arena.x; topRope.y = bounds.top + 100; game.addChild(topRope); ropes.push(topRope); // Create right rope var rightRope = new Rope(); rightRope.x = bounds.right - 100; rightRope.y = arena.y; rightRope.rotation = Math.PI / 2; // Rotate 90 degrees game.addChild(rightRope); ropes.push(rightRope); // Create bottom rope var bottomRope = new Rope(); bottomRope.x = arena.x; bottomRope.y = bounds.bottom - 100; game.addChild(bottomRope); ropes.push(bottomRope); // Create left rope var leftRope = new Rope(); leftRope.x = bounds.left + 100; leftRope.y = arena.y; leftRope.rotation = Math.PI / 2; // Rotate 90 degrees game.addChild(leftRope); ropes.push(leftRope); } function createPopcorn(count) { for (var i = 0; i < count; i++) { var popcorn = new Popcorn(); // Random position within arena bounds popcorn.x = bounds.left + 100 + Math.random() * (arena.width - 200); popcorn.y = bounds.top + 100 + Math.random() * (arena.height - 200); // Add to game game.addChild(popcorn); popcorns.push(popcorn); } } // Game events game.onChickenJockeyStop = function () { gameState = "ready"; // Check if we need to add more popcorn if (popcorns.length < 5) { createPopcorn(5); } // Check if out of launches if (launches >= maxLaunches) { // Check if score milestones are reached to reset launches if (score >= 1000 || score >= 500 && launches == maxLaunches || score >= 200 && launches == maxLaunches) { launches = 0; maxLaunches = 5; // Reset to initial max launches instructionText.setText("Launches reset! Keep going!"); launchesText.setText("Launches: " + launches + "/" + maxLaunches); resetChickenJockey(); } else { // Game over instructionText.setText("Game Over! Final Score: " + score); gameState = "gameOver"; // Show game over after a short delay LK.setTimeout(function () { LK.showGameOver(); }, 2000); } } else { // Reset for next launch resetChickenJockey(); instructionText.setText("Drag to aim and launch the chicken!"); } }; game.onMaxBouncesReached = function () { // Same as onChickenJockeyStop for now game.onChickenJockeyStop(); }; // Input handling var dragStartX = 0; var dragStartY = 0; game.down = function (x, y, obj) { if (gameState === "ready") { gameState = "aiming"; dragStartX = x; dragStartY = y; launcher.startAim(x, y); instructionText.setText("Swipe to launch the chicken!"); } }; game.move = function (x, y, obj) { if (gameState === "aiming") { launcher.updateAim(x, y); } }; game.up = function (x, y, obj) { if (gameState === "aiming") { // Calculate swipe distance and direction var dx = x - dragStartX; var dy = y - dragStartY; var distance = Math.sqrt(dx * dx + dy * dy); // Only launch if there was a significant swipe (prevents accidental taps) if (distance > 20) { // Get launch parameters var launchParams = launcher.endAim(); // Launch the chicken chickenJockey.launch(launchParams.power, launchParams.angle); // Update game state gameState = "launched"; launches++; launchesText.setText("Launches: " + launches + "/" + maxLaunches); instructionText.setText("Watch the chicken bounce!"); } else { // Cancel the launch if it was just a tap launcher.endAim(); gameState = "ready"; } } }; // Main game loop game.update = function () { // Update all game objects if (gameState === "launched") { chickenJockey.update(); // Check for collisions with arena boundaries if (chickenJockey.x < bounds.left) { chickenJockey.x = bounds.left; chickenJockey.vx = -chickenJockey.vx * chickenJockey.bounceDecay * chickenJockey.bounceDecay; // Apply decay on horizontal bounce chickenJockey.bounceCount++; LK.getSound('bounce').play(); } else if (chickenJockey.x > bounds.right) { chickenJockey.x = bounds.right; chickenJockey.vx = -chickenJockey.vx * chickenJockey.bounceDecay * chickenJockey.bounceDecay; // Apply decay on horizontal bounce chickenJockey.bounceCount++; LK.getSound('bounce').play(); } if (chickenJockey.y < bounds.top) { chickenJockey.y = bounds.top; chickenJockey.vy = -chickenJockey.vy * chickenJockey.bounceDecay * chickenJockey.bounceDecay; // Apply decay on vertical bounce chickenJockey.bounceCount++; LK.getSound('bounce').play(); } else if (chickenJockey.y > bounds.bottom) { chickenJockey.y = bounds.bottom; chickenJockey.vy = -chickenJockey.vy * chickenJockey.bounceDecay * chickenJockey.bounceDecay; // Apply decay on vertical bounce chickenJockey.bounceCount++; LK.getSound('bounce').play(); } // Check for collisions with ropes for (var i = 0; i < ropes.length; i++) { if (chickenJockey.intersects(ropes[i])) { ropes[i].bounce(chickenJockey); } } // Check for collisions with popcorn for (var i = popcorns.length - 1; i >= 0; i--) { if (chickenJockey.intersects(popcorns[i])) { // Collect popcorn popcorns[i].collect(); // Remove from array popcorns.splice(i, 1); // Increase score score += 10; scoreText.setText("Score: " + score); // Save score to LK LK.setScore(score); } } } // Update popcorn animations for (var i = 0; i < popcorns.length; i++) { popcorns[i].update(); } }; // Initialize the game initGame();
===================================================================
--- original.js
+++ change.js
@@ -17,9 +17,9 @@
// Physics properties
self.vx = 0;
self.vy = 0;
self.gravity = 0.5;
- self.bounceDecay = 0.8; // Very minimal energy loss per bounce
+ self.bounceDecay = 0.9; // Slightly more energy loss per bounce for better control
self.friction = 0.995; // Reduced horizontal friction
self.launched = false;
self.bounceCount = 0;
self.maxBounces = 30; // Allow more bounces before stopping
@@ -126,9 +126,9 @@
aimLine.rotation = Math.atan2(dy, dx);
aimLine.width = Math.min(distance, 300);
// Calculate power based on swipe speed and distance
var swipeTime = Math.max(Date.now() - self.swipeStartTime, 100);
- self.power = Math.min(distance / swipeTime * 200, self.maxPower);
+ self.power = Math.min(distance / swipeTime * 100, self.maxPower); // Reduced power multiplier
};
self.endAim = function () {
self.aiming = false;
aimLine.alpha = 0;
@@ -189,20 +189,17 @@
anchorX: 0.5,
anchorY: 0.5
});
// Rope properties
- self.tension = 3.5; // Extremely high tension for super bouncy ropes
+ self.tension = 4.0; // Slightly higher tension
self.bounce = function (chickenJockey) {
// Calculate new velocity based on collision angle and rope tension
- var normalAngle = Math.atan2(chickenJockey.y - self.y, chickenJockey.x - self.x) + Math.PI / 2;
- // Calculate velocity components along normal direction
- var vn = chickenJockey.vx * Math.cos(normalAngle) + chickenJockey.vy * Math.sin(normalAngle);
- var vt = -chickenJockey.vx * Math.sin(normalAngle) + chickenJockey.vy * Math.cos(normalAngle);
- // Reverse normal component with tension and bounce decay
- vn = -vn * chickenJockey.bounceDecay * self.tension;
- // Convert back to x,y velocities
- chickenJockey.vx = vn * Math.cos(normalAngle) - vt * Math.sin(normalAngle);
- chickenJockey.vy = vn * Math.sin(normalAngle) + vt * Math.cos(normalAngle);
+ var normalAngle = Math.atan2(chickenJockey.y - self.y, chickenJockey.x - self.x); // Angle from rope to chicken
+ // Calculate new velocity based on angle and tension
+ var speed = Math.sqrt(chickenJockey.vx * chickenJockey.vx + chickenJockey.vy * chickenJockey.vy);
+ var bounceAngle = 2 * normalAngle - Math.atan2(chickenJockey.vy, chickenJockey.vx); // Angle of reflection
+ chickenJockey.vx = speed * Math.cos(bounceAngle) * chickenJockey.bounceDecay * self.tension;
+ chickenJockey.vy = speed * Math.sin(bounceAngle) * chickenJockey.bounceDecay * self.tension;
// Increment bounce count
chickenJockey.bounceCount++;
// Play bounce sound
LK.getSound('bounce').play();
@@ -443,25 +440,25 @@
chickenJockey.update();
// Check for collisions with arena boundaries
if (chickenJockey.x < bounds.left) {
chickenJockey.x = bounds.left;
- chickenJockey.vx = -chickenJockey.vx * chickenJockey.bounceDecay;
+ chickenJockey.vx = -chickenJockey.vx * chickenJockey.bounceDecay * chickenJockey.bounceDecay; // Apply decay on horizontal bounce
chickenJockey.bounceCount++;
LK.getSound('bounce').play();
} else if (chickenJockey.x > bounds.right) {
chickenJockey.x = bounds.right;
- chickenJockey.vx = -chickenJockey.vx * chickenJockey.bounceDecay;
+ chickenJockey.vx = -chickenJockey.vx * chickenJockey.bounceDecay * chickenJockey.bounceDecay; // Apply decay on horizontal bounce
chickenJockey.bounceCount++;
LK.getSound('bounce').play();
}
if (chickenJockey.y < bounds.top) {
chickenJockey.y = bounds.top;
- chickenJockey.vy = -chickenJockey.vy * chickenJockey.bounceDecay;
+ chickenJockey.vy = -chickenJockey.vy * chickenJockey.bounceDecay * chickenJockey.bounceDecay; // Apply decay on vertical bounce
chickenJockey.bounceCount++;
LK.getSound('bounce').play();
} else if (chickenJockey.y > bounds.bottom) {
chickenJockey.y = bounds.bottom;
- chickenJockey.vy = -chickenJockey.vy * chickenJockey.bounceDecay;
+ chickenJockey.vy = -chickenJockey.vy * chickenJockey.bounceDecay * chickenJockey.bounceDecay; // Apply decay on vertical bounce
chickenJockey.bounceCount++;
LK.getSound('bounce').play();
}
// Check for collisions with ropes
X5 symbol. In-Game asset. 2d. High contrast. No shadows
X2 symbol. In-Game asset. 2d. High contrast. No shadows
Super popcorn yellow. In-Game asset. 2d. High contrast. No shadows
Start button. In-Game asset. 2d. High contrast. No shadows
High score button. In-Game asset. 2d. High contrast. No shadows
Back button. In-Game asset. 2d. High contrast. No shadows
SELECT YOUR CHARACTER button. In-Game asset. 2d. High contrast. No shadows
Launches button. In-Game asset. 2d. High contrast. No shadows
How to play button. In-Game asset. 2d. High contrast. No shadows
Score button. In-Game asset. 2d. High contrast. No shadows
High Scores button. In-Game asset. 2d. High contrast. No shadows
Transparent padlock. In-Game asset. 2d. High contrast. No shadows
Chicken jockey character. In-Game asset. 2d. High contrast. No shadows
Reset scores button. In-Game asset. 2d. High contrast. No shadows
Spider jockey unlocked button. In-Game asset. 2d. High contrast. No shadows
Minecraft Steve unlocked button. In-Game asset. 2d. High contrast. No shadows
Piglin unlocked button. In-Game asset. 2d. High contrast. No shadows
Minecraft skeleton unlocked button. In-Game asset. 2d. High contrast. No shadows
Minecraft villager unlocked button. In-Game asset. 2d. High contrast. No shadows
Star. In-Game asset. 2d. High contrast. No shadows
White star. In-Game asset. 2d. High contrast. No shadows
Red heart. In-Game asset. 2d. High contrast. No shadows
Purple heart. In-Game asset. 2d. High contrast. No shadows
A peanut. In-Game asset. 2d. High contrast. No shadows
Cashew nut. In-Game asset. 2d. High contrast. No shadows
Grimace shake. In-Game asset. 2d. High contrast. No shadows
MacDonald's fries. In-Game asset. 2d. High contrast. No shadows
Grimace unlocked button. In-Game asset. 2d. High contrast. No shadows
Michael Jackson unlocked button. In-Game asset. 2d. High contrast. No shadows
John Cena unlocked button. In-Game asset. 2d. High contrast. No shadows
Deez nuts unlocked button. In-Game asset. 2d. High contrast. No shadows
Shooting stars unlocked button. In-Game asset. 2d. High contrast. No shadows
Rick roll unlocked button. In-Game asset. 2d. High contrast. No shadows
Popcorn chicken. In-Game asset. 2d. High contrast. No shadows
Fried chicken drumstick. In-Game asset. 2d. High contrast. No shadows
Amazing digital circus button. In-Game asset. 2d. High contrast. No shadows
Select game mode button. In-Game asset. 2d. High contrast. No shadows
Diamond shaped colourful classic mode button. In-Game asset. 2d. High contrast. No shadows
Diamond shaped colourful mini games button. In-Game asset. 2d. High contrast. No shadows
Same picture in high definition
Diamond shaped colourful button that says sling shot mode. In-Game asset. 2d. High contrast. No shadows
Make picture transparent
Bullet. In-Game asset. 2d. High contrast. No shadows
Start game button. In-Game asset. 2d. High contrast. No shadows
Shooting gallery button. In-Game asset. 2d. High contrast. No shadows
Chain reaction button. In-Game asset. 2d. High contrast. No shadows
Realistic space backdrop. In-Game asset. 2d. High contrast. No shadows
launch
Sound effect
Gamestart
Sound effect
collect
Sound effect
gameMusic
Music
Gamemusic
Sound effect
Bogerk
Sound effect
pop
Sound effect
Pignoise
Sound effect
Steve
Sound effect
Villager
Sound effect
Spider
Sound effect
Skeleton
Sound effect
Shootingstars
Music
Maccas
Sound effect
Grimace
Sound effect
Thriller
Music
MJ
Sound effect
Cenaentrance
Music
Johncena
Sound effect
Chickencluck
Sound effect
Deeznuts
Sound effect
Deeznutstrap
Music
Rickroll
Sound effect
Nevergonna
Music
Starz
Sound effect
Grimaceshake
Music
Joenugget
Sound effect
gegagedi
Music
Shrek
Sound effect
Raveswamp
Music
Pomni
Sound effect
Digcircus
Music
Runandgo
Music
Gunshot
Sound effect
Reelbadman
Sound effect
Tinggoes
Music