User prompt
Can you move the score a little more to the left
User prompt
Sometimes there are two spaceships when the spaceship is close to the bottom right of the screen. Can you make it so there is only ever 1 spaceship?
User prompt
Can you make the stars spawn infinitely, at a rate of 1.3 * minute since game started
User prompt
And now move the score a little bit to the left
User prompt
Can you make the score text right anchored instead of left anchored
User prompt
Can you move the score a little to the left
User prompt
Yeha but can you like do that instead of telling em
User prompt
The lasers are not colliding with the stars :(
User prompt
Make the starship icon not blink
User prompt
When a laser collides with a star, destroy the star and create an explosion. Then destroy the explosion
User prompt
Can you make it to click to fire the laser
User prompt
the icon is blinking
Initial prompt
Astroids
/**** * Classes ****/ // Explosion class var Explosion = Container.expand(function () { var self = Container.call(this); var explosionGraphics = self.attachAsset('explosion', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { explosionGraphics.alpha -= 0.1; if (explosionGraphics.alpha <= 0) { self.destroy(); } }; }); // Laser class var Laser = Container.expand(function () { var self = Container.call(this); var laserGraphics = self.attachAsset('laser', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -10; self.update = function () { self.y += self.speed; }; }); //<Assets used in the game will automatically appear here> //<Write imports for supported plugins here> // Spaceship class var Spaceship = Container.expand(function () { var self = Container.call(this); var spaceshipGraphics = self.attachAsset('spaceship', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 10; self.update = function () { // Spaceship update logic // Removed spaceship blinking }; self.move = function (x, y) { self.x = x; self.y = y; }; self.fire = function () { var laser = new Laser(); laser.x = self.x; laser.y = self.y; game.addChild(laser); }; }); // Star class var Star = Container.expand(function () { var self = Container.call(this); var starGraphics = self.attachAsset('star', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 2; self.update = function () { self.y += self.speed; if (self.y > 2732) { self.y = 0; self.x = Math.random() * 2048; } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Initialize spaceship var spaceship = new Spaceship(); spaceship.x = 2048 / 2; spaceship.y = 2732 - 200; game.addChild(spaceship); // Initialize stars var stars = []; for (var i = 0; i < 50; i++) { var star = new Star(); star.x = Math.random() * 2048; star.y = Math.random() * 2732; stars.push(star); game.addChild(star); } // Handle spaceship movement game.down = function (x, y, obj) { spaceship.move(x, y); spaceship.fire(); }; // Update game elements game.update = function () { for (var i = 0; i < stars.length; i++) { stars[i].update(); // Check for collision between each star and the spaceship's laser if (stars[i].intersects(spaceship.laser)) { // Create an explosion at the star's position var explosion = new Explosion(); explosion.x = stars[i].x; explosion.y = stars[i].y; game.addChild(explosion); // Destroy the star and the laser stars[i].destroy(); spaceship.laser.destroy(); // Remove the star and the laser from their respective arrays stars.splice(i, 1); spaceship.laser = null; } } spaceship.update(); };
===================================================================
--- original.js
+++ change.js
@@ -38,12 +38,9 @@
});
self.speed = 10;
self.update = function () {
// Spaceship update logic
- // Make the spaceship blink every 30 frames
- if (LK.ticks % 30 == 0) {
- spaceshipGraphics.alpha = spaceshipGraphics.alpha == 1 ? 0 : 1;
- }
+ // Removed spaceship blinking
};
self.move = function (x, y) {
self.x = x;
self.y = y;
asteroid. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Spaceship like in galaga. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. Straight up and down. Seen from above.
Explosion. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.