User prompt
Make it so that the image "background" is in the background
User prompt
make it so that the max points is 500 to win, and you have 5 lives
User prompt
now make it so that the sound "background" plays until the end then restarts infinitly
User prompt
make it go just a little bit higher
User prompt
make the shapes go higher
User prompt
the images wont show up. Also pls add a life system. you have 3 lives. if you miss the memes 3 times you get a game over
User prompt
pls do it again,
User prompt
I'm going to add a few more images, then you can add them to the assets looks!
User prompt
Fruit Ninja for sure, only let's make it a Meme Ninja where you slice meme images. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Restart everything, please.
User prompt
Initial prompt
Hi Ava!
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var MemeObject = Container.expand(function () { var self = Container.call(this); // Array of meme asset IDs var memeAssets = ['meme1', 'meme2', 'meme3', 'meme4']; var randomMeme = memeAssets[Math.floor(Math.random() * memeAssets.length)]; var memeGraphics = self.attachAsset(randomMeme, { anchorX: 0.5, anchorY: 0.5 }); self.isSliced = false; self.velocityX = (Math.random() - 0.5) * 200; // Random horizontal velocity self.velocityY = Math.random() * 300 + 200; // Upward velocity self.gravity = 800; // Gravity pulling down self.rotationSpeed = (Math.random() - 0.5) * 0.1; // Random rotation self.update = function () { if (!self.isSliced) { // Apply physics self.velocityY += self.gravity * (1 / 60); // Assuming 60 FPS self.x += self.velocityX * (1 / 60); self.y += self.velocityY * (1 / 60); self.rotation += self.rotationSpeed; } }; self.slice = function () { if (!self.isSliced) { self.isSliced = true; LK.getSound('slice').play(); // Create slice effect - split into two pieces var leftPiece = self.attachAsset(randomMeme, { anchorX: 0.5, anchorY: 0.5, x: -50, alpha: 0.8 }); var rightPiece = self.attachAsset(randomMeme, { anchorX: 0.5, anchorY: 0.5, x: 50, alpha: 0.8 }); // Hide original memeGraphics.visible = false; // Animate pieces falling apart tween(leftPiece, { x: -200, y: 200, rotation: -1, alpha: 0 }, { duration: 1000, easing: tween.easeIn }); tween(rightPiece, { x: 200, y: 200, rotation: 1, alpha: 0 }, { duration: 1000, easing: tween.easeIn }); // Score increase LK.setScore(LK.getScore() + 10); scoreTxt.setText(LK.getScore()); } }; return self; }); var SliceTrail = Container.expand(function () { var self = Container.call(this); var trailGraphics = self.attachAsset('slice_trail', { anchorX: 0.5, anchorY: 0.5, alpha: 0.8 }); self.fadeOut = function () { tween(self, { alpha: 0, scaleX: 0.5, scaleY: 0.5 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); } }); }; return self; }); /**** * Initialize Game ****/ // Game variables // Assets will be defined here as needed var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // Game variables // Initialize meme image assets and game elements var memes = []; var sliceTrails = []; var isSlicing = false; var lastSliceX = 0; var lastSliceY = 0; // Set up score display var scoreTxt = new Text2('0', { size: 100, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); scoreTxt.y = 80; // Move down from very top // Spawn memes periodically var spawnTimer = LK.setInterval(function () { var newMeme = new MemeObject(); newMeme.x = Math.random() * (2048 - 400) + 200; // Random X position newMeme.y = 2732 + 100; // Start below screen newMeme.velocityY = -(Math.random() * 400 + 600); // Strong upward velocity memes.push(newMeme); game.addChild(newMeme); }, 1500); // Spawn every 1.5 seconds // Handle slicing input game.down = function (x, y, obj) { isSlicing = true; lastSliceX = x; lastSliceY = y; }; game.move = function (x, y, obj) { if (isSlicing) { // Create slice trail var trail = new SliceTrail(); trail.x = x; trail.y = y; sliceTrails.push(trail); game.addChild(trail); trail.fadeOut(); // Check for meme hits along the slice line for (var i = 0; i < memes.length; i++) { var meme = memes[i]; if (!meme.isSliced) { var dx = x - meme.x; var dy = y - meme.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < 120) { // Hit radius meme.slice(); } } } lastSliceX = x; lastSliceY = y; } }; game.up = function (x, y, obj) { isSlicing = false; }; // Main game loop game.update = function () { // Update all memes for (var i = memes.length - 1; i >= 0; i--) { var meme = memes[i]; // Remove memes that are off screen if (meme.y > 2732 + 200 || meme.isSliced && meme.y > 2732 + 400) { if (!meme.isSliced) { // Missed meme - play miss sound LK.getSound('miss').play(); } meme.destroy(); memes.splice(i, 1); } } // Clean up old slice trails for (var j = sliceTrails.length - 1; j >= 0; j--) { var trail = sliceTrails[j]; if (trail.alpha <= 0) { sliceTrails.splice(j, 1); } } // Win condition if (LK.getScore() >= 100) { LK.showYouWin(); } };
===================================================================
--- original.js
+++ change.js
@@ -1,7 +1,197 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+var MemeObject = Container.expand(function () {
+ var self = Container.call(this);
+ // Array of meme asset IDs
+ var memeAssets = ['meme1', 'meme2', 'meme3', 'meme4'];
+ var randomMeme = memeAssets[Math.floor(Math.random() * memeAssets.length)];
+ var memeGraphics = self.attachAsset(randomMeme, {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.isSliced = false;
+ self.velocityX = (Math.random() - 0.5) * 200; // Random horizontal velocity
+ self.velocityY = Math.random() * 300 + 200; // Upward velocity
+ self.gravity = 800; // Gravity pulling down
+ self.rotationSpeed = (Math.random() - 0.5) * 0.1; // Random rotation
+ self.update = function () {
+ if (!self.isSliced) {
+ // Apply physics
+ self.velocityY += self.gravity * (1 / 60); // Assuming 60 FPS
+ self.x += self.velocityX * (1 / 60);
+ self.y += self.velocityY * (1 / 60);
+ self.rotation += self.rotationSpeed;
+ }
+ };
+ self.slice = function () {
+ if (!self.isSliced) {
+ self.isSliced = true;
+ LK.getSound('slice').play();
+ // Create slice effect - split into two pieces
+ var leftPiece = self.attachAsset(randomMeme, {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: -50,
+ alpha: 0.8
+ });
+ var rightPiece = self.attachAsset(randomMeme, {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 50,
+ alpha: 0.8
+ });
+ // Hide original
+ memeGraphics.visible = false;
+ // Animate pieces falling apart
+ tween(leftPiece, {
+ x: -200,
+ y: 200,
+ rotation: -1,
+ alpha: 0
+ }, {
+ duration: 1000,
+ easing: tween.easeIn
+ });
+ tween(rightPiece, {
+ x: 200,
+ y: 200,
+ rotation: 1,
+ alpha: 0
+ }, {
+ duration: 1000,
+ easing: tween.easeIn
+ });
+ // Score increase
+ LK.setScore(LK.getScore() + 10);
+ scoreTxt.setText(LK.getScore());
+ }
+ };
+ return self;
+});
+var SliceTrail = Container.expand(function () {
+ var self = Container.call(this);
+ var trailGraphics = self.attachAsset('slice_trail', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ alpha: 0.8
+ });
+ self.fadeOut = function () {
+ tween(self, {
+ alpha: 0,
+ scaleX: 0.5,
+ scaleY: 0.5
+ }, {
+ duration: 200,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ self.destroy();
+ }
+ });
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
+// Game variables
// Assets will be defined here as needed
var game = new LK.Game({
backgroundColor: 0x000000
-});
\ No newline at end of file
+});
+
+/****
+* Game Code
+****/
+// Game variables
+// Initialize meme image assets and game elements
+var memes = [];
+var sliceTrails = [];
+var isSlicing = false;
+var lastSliceX = 0;
+var lastSliceY = 0;
+// Set up score display
+var scoreTxt = new Text2('0', {
+ size: 100,
+ fill: 0xFFFFFF
+});
+scoreTxt.anchor.set(0.5, 0);
+LK.gui.top.addChild(scoreTxt);
+scoreTxt.y = 80; // Move down from very top
+// Spawn memes periodically
+var spawnTimer = LK.setInterval(function () {
+ var newMeme = new MemeObject();
+ newMeme.x = Math.random() * (2048 - 400) + 200; // Random X position
+ newMeme.y = 2732 + 100; // Start below screen
+ newMeme.velocityY = -(Math.random() * 400 + 600); // Strong upward velocity
+ memes.push(newMeme);
+ game.addChild(newMeme);
+}, 1500); // Spawn every 1.5 seconds
+// Handle slicing input
+game.down = function (x, y, obj) {
+ isSlicing = true;
+ lastSliceX = x;
+ lastSliceY = y;
+};
+game.move = function (x, y, obj) {
+ if (isSlicing) {
+ // Create slice trail
+ var trail = new SliceTrail();
+ trail.x = x;
+ trail.y = y;
+ sliceTrails.push(trail);
+ game.addChild(trail);
+ trail.fadeOut();
+ // Check for meme hits along the slice line
+ for (var i = 0; i < memes.length; i++) {
+ var meme = memes[i];
+ if (!meme.isSliced) {
+ var dx = x - meme.x;
+ var dy = y - meme.y;
+ var distance = Math.sqrt(dx * dx + dy * dy);
+ if (distance < 120) {
+ // Hit radius
+ meme.slice();
+ }
+ }
+ }
+ lastSliceX = x;
+ lastSliceY = y;
+ }
+};
+game.up = function (x, y, obj) {
+ isSlicing = false;
+};
+// Main game loop
+game.update = function () {
+ // Update all memes
+ for (var i = memes.length - 1; i >= 0; i--) {
+ var meme = memes[i];
+ // Remove memes that are off screen
+ if (meme.y > 2732 + 200 || meme.isSliced && meme.y > 2732 + 400) {
+ if (!meme.isSliced) {
+ // Missed meme - play miss sound
+ LK.getSound('miss').play();
+ }
+ meme.destroy();
+ memes.splice(i, 1);
+ }
+ }
+ // Clean up old slice trails
+ for (var j = sliceTrails.length - 1; j >= 0; j--) {
+ var trail = sliceTrails[j];
+ if (trail.alpha <= 0) {
+ sliceTrails.splice(j, 1);
+ }
+ }
+ // Win condition
+ if (LK.getScore() >= 100) {
+ LK.showYouWin();
+ }
+};
\ No newline at end of file