Code edit (1 edits merged)
Please save this source code
User prompt
their is a moon ithe corner of the screen in the gameplay can you remove that
User prompt
i cant hear the sounds
User prompt
very good, can you add more decor to the game in general (not the same assets new ones)
User prompt
add a pixelated moon picture at the bottom
User prompt
spot on but add more decore on the start screen
User prompt
make a screen before the game with a start button when yoh press it it starts the game
User prompt
scrap the idea
User prompt
its good just can you add a start butten so when you hit it ,it statrts the game
User prompt
make a title screen
User prompt
make that a asset
User prompt
- **Slow Motion:** Temporarily slows down all asteroids when picked up power up
User prompt
do dynamic difficulty
User prompt
Please fix the bug: 'TypeError: LK.effects.shakeScreen is not a function' in or related to this line: 'LK.effects.shakeScreen(0xff0000, 800, 20); // Strong shake on collision' Line Number: 88
User prompt
Please fix the bug: 'TypeError: LK.effects.shake is not a function' in or related to this line: 'LK.effects.shake({' Line Number: 88
User prompt
Please fix the bug: 'TypeError: LK.effects.shakeScreen is not a function' in or related to this line: 'LK.effects.shakeScreen(800, 20); // Strong shake on collision' Line Number: 88
User prompt
yes do thatt
User prompt
Make the score on top.
User prompt
Make every astro that the spaceship dodges, make that count as a point.
User prompt
No, just make them come down in your direction.
User prompt
Yes, but make the asteroids come for you.
User prompt
Make it go left to right. It can't move up or down.
Initial prompt
asteroid dodger
/**** * Classes ****/ // Asteroid class var Asteroid = Container.expand(function () { var self = Container.call(this); var asteroidGraphics = self.attachAsset('asteroid', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; 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 if needed }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Initialize spaceship var spaceship = game.addChild(new Spaceship()); spaceship.x = 2048 / 2; spaceship.y = 2732 - 200; // Array to hold asteroids var asteroids = []; // Function to handle spaceship movement function handleMove(x, y, obj) { spaceship.x = x; // spaceship.y = y; // Commented out to restrict vertical movement } // Game move event game.move = handleMove; // Game update function game.update = function () { // Create new asteroids if (LK.ticks % 60 == 0) { var newAsteroid = new Asteroid(); newAsteroid.x = Math.random() * 2048; newAsteroid.y = -50; asteroids.push(newAsteroid); game.addChild(newAsteroid); } // Update asteroids for (var i = asteroids.length - 1; i >= 0; i--) { var asteroid = asteroids[i]; asteroid.update(); // Check for collision with spaceship if (spaceship.intersects(asteroid)) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); return; } // Remove off-screen asteroids if (asteroid.y > 2732 + 50) { asteroid.destroy(); asteroids.splice(i, 1); } } };
===================================================================
--- original.js
+++ change.js
@@ -9,13 +9,9 @@
anchorY: 0.5
});
self.speed = 5;
self.update = function () {
- var dx = spaceship.x - self.x;
- var dy = spaceship.y - self.y;
- var angle = Math.atan2(dy, dx);
- self.x += Math.cos(angle) * self.speed;
- self.y += Math.sin(angle) * self.speed;
+ self.y += self.speed;
};
});
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>