User prompt
When a meters get to the bottom you loose
User prompt
When you die make it were it says you high score
User prompt
Fix problems
User prompt
Make it were there are settings like how small/big the stuff is and open your mouth to shoot ↪💡 Consider importing and using the following plugins: @upit/storage.v1, @upit/facekit.v1
User prompt
Please fix the bug: 'Can't find variable: camera' in or related to this line: 'camera.setZoom(1.5);' Line Number: 80 ↪💡 Consider importing and using the following plugins: @upit/facekit.v1
User prompt
Please fix the bug: 'Can't find variable: camera' in or related to this line: 'camera.setZoom(1.5);' Line Number: 80 ↪💡 Consider importing and using the following plugins: @upit/facekit.v1
User prompt
Fix it
User prompt
Fix
User prompt
Please fix the bug: 'Can't find variable: camera' in or related to this line: 'camera.setZoom(1.5);' Line Number: 80
User prompt
Please fix the bug: 'Can't find variable: camera' in or related to this line: 'camera.setZoom(1.5);' Line Number: 80
User prompt
Make the screen closer
User prompt
Make only on type of asteroid medium
User prompt
Tap to fire
User prompt
Make it were you can move forward
Code edit (1 edits merged)
Please save this source code
User prompt
Asteroid Blaster
Initial prompt
Make a game were you shoot astroids
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Asteroid = Container.expand(function (size) { var self = Container.call(this); var assetName = 'asteroidLarge'; self.points = 10; if (size === 'medium') { assetName = 'asteroidMedium'; self.points = 20; } else if (size === 'small') { assetName = 'asteroidSmall'; self.points = 30; } var asteroidGraphics = self.attachAsset(assetName, { anchorX: 0.5, anchorY: 0.5 }); self.speed = Math.random() * 3 + 1; self.rotationSpeed = (Math.random() - 0.5) * 0.1; self.update = function () { self.y += self.speed; asteroidGraphics.rotation += self.rotationSpeed; }; return self; }); var Bullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('bullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -8; self.update = function () { self.y += self.speed; }; return self; }); var Ship = Container.expand(function () { var self = Container.call(this); var shipGraphics = self.attachAsset('ship', { anchorX: 0.5, anchorY: 0.5 }); return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000022 }); /**** * Game Code ****/ var ship = game.addChild(new Ship()); ship.x = 2048 / 2; ship.y = 2732 - 150; var bullets = []; var asteroids = []; var bulletTimer = 0; var asteroidTimer = 0; var asteroidSpawnRate = 90; var dragNode = null; var scoreTxt = new Text2('0', { size: 80, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); function spawnAsteroid() { var sizes = ['large', 'medium', 'small']; var size = sizes[Math.floor(Math.random() * sizes.length)]; var asteroid = new Asteroid(size); asteroid.x = Math.random() * (2048 - 100) + 50; asteroid.y = -60; asteroids.push(asteroid); game.addChild(asteroid); } function fireBullet() { var bullet = new Bullet(); bullet.x = ship.x; bullet.y = ship.y - 50; bullets.push(bullet); game.addChild(bullet); LK.getSound('shoot').play(); } game.move = function (x, y, obj) { if (dragNode) { dragNode.x = Math.max(40, Math.min(2048 - 40, x)); // Allow vertical movement - move forward when dragging up dragNode.y = Math.max(150, Math.min(2732 - 150, y)); } }; game.down = function (x, y, obj) { dragNode = ship; ship.x = Math.max(40, Math.min(2048 - 40, x)); // Allow initial vertical positioning when touching down ship.y = Math.max(150, Math.min(2732 - 150, y)); }; game.up = function (x, y, obj) { dragNode = null; }; game.update = function () { bulletTimer++; asteroidTimer++; // Fire bullets automatically if (bulletTimer >= 20) { fireBullet(); bulletTimer = 0; } // Spawn asteroids if (asteroidTimer >= asteroidSpawnRate) { spawnAsteroid(); asteroidTimer = 0; // Gradually increase difficulty if (asteroidSpawnRate > 30) { asteroidSpawnRate -= 0.5; } } // Update and check bullets for (var i = bullets.length - 1; i >= 0; i--) { var bullet = bullets[i]; if (bullet.y < -50) { bullet.destroy(); bullets.splice(i, 1); continue; } // Check bullet-asteroid collisions for (var j = asteroids.length - 1; j >= 0; j--) { var asteroid = asteroids[j]; if (bullet.intersects(asteroid)) { LK.setScore(LK.getScore() + asteroid.points); scoreTxt.setText(LK.getScore()); LK.getSound('explosion').play(); // Flash effect on hit LK.effects.flashObject(asteroid, 0xffffff, 200); bullet.destroy(); bullets.splice(i, 1); asteroid.destroy(); asteroids.splice(j, 1); break; } } } // Update and check asteroids for (var k = asteroids.length - 1; k >= 0; k--) { var asteroid = asteroids[k]; if (asteroid.y > 2732 + 100) { asteroid.destroy(); asteroids.splice(k, 1); continue; } // Check ship-asteroid collision if (ship.intersects(asteroid)) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); return; } } };
===================================================================
--- original.js
+++ change.js
@@ -94,13 +94,17 @@
}
game.move = function (x, y, obj) {
if (dragNode) {
dragNode.x = Math.max(40, Math.min(2048 - 40, x));
+ // Allow vertical movement - move forward when dragging up
+ dragNode.y = Math.max(150, Math.min(2732 - 150, y));
}
};
game.down = function (x, y, obj) {
dragNode = ship;
ship.x = Math.max(40, Math.min(2048 - 40, x));
+ // Allow initial vertical positioning when touching down
+ ship.y = Math.max(150, Math.min(2732 - 150, y));
};
game.up = function (x, y, obj) {
dragNode = null;
};