User prompt
Similar to tube television, where the screen colors are distorted and shifted.
Code edit (1 edits merged)
Please save this source code
User prompt
Astro-Blaster
User prompt
Objective for AI: The objective for an artificial intelligence playing Astro-Blaster would be to maximize its score by: Survival: Prioritizing avoiding collisions with asteroids and enemy projectiles. Target Prioritization: Deciding which enemies to engage first (e.g., higher-threat enemies, enemies that will soon fire, or groups of enemies for efficient clearing). Power-up Collection: Efficiently collecting beneficial power-ups while avoiding those that might put the player in danger. Resource Management: Judiciously using the limited special ability for optimal impact (e.g., clearing the screen during overwhelming situations or for boss damage). Pattern Recognition: Learning and adapting to enemy movement patterns and boss attack sequences. Optimal Pathing: Navigating the asteroid field to create safe zones and maximize firing opportunities.
User prompt
Scoring: Points are awarded for destroying asteroids, alien ships, and collecting power-ups. Higher scores are achieved by surviving longer and defeating bosses. Lives System: The player starts with a set number of lives. Losing all lives results in a "Game Over." Visuals: Pixel art style with vibrant colors, simple animations, and classic arcade sound effects. The background scrolls vertically to give the illusion of movement through space.
User prompt
Power-ups: Weapon Upgrades: Increase fire rate, add spread shots, or enhance projectile power. Shields: Temporary invincibility. Extra Lives: Grants an additional attempt. Score Multipliers: Boosts the points gained from destroying enemies.
User prompt
Power-ups: Weapon Upgrades: Increase fire rate, add spread shots, or enhance projectile power. Shields: Temporary invincibility. Extra Lives: Grants an additional attempt. Score Multipliers: Boosts the points gained from destroying enemies.
User prompt
Gameplay Elements: Player Ship: A small, agile spaceship. Enemies: Asteroids: Environmental hazards that must be avoided or destroyed. They come in various sizes. Alien Fighters: Basic enemy ships that fly in formations and fire simple projectiles. Elite Aliens: More durable and aggressive enemies with unique attack patterns. Bosses: Large, multi-stage enemies that appear after a certain number of waves, offering significant score bonuses upon defeat.
Initial prompt
Retro Control Scheme: The game utilizes a very simple, retro control scheme, similar to early arcade games, designed for immediate understanding and quick reactions.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Asteroid = Container.expand(function () { var self = Container.call(this); var asteroidGraphics = self.attachAsset('asteroid', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 2 + Math.random() * 3; self.rotationSpeed = (Math.random() - 0.5) * 0.1; self.update = function () { self.y += self.speed; asteroidGraphics.rotation += self.rotationSpeed; }; return self; }); var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.attachAsset('enemy', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 1 + Math.random() * 2; self.shootTimer = 0; self.shootDelay = 60 + Math.random() * 60; self.health = 1; self.update = function () { self.y += self.speed; self.x += Math.sin(self.y * 0.01) * 2; if (self.shootTimer > 0) { self.shootTimer--; } }; self.canShoot = function () { return self.shootTimer <= 0 && self.y > 100; }; self.shoot = function () { if (self.canShoot()) { self.shootTimer = self.shootDelay; return true; } return false; }; return self; }); var EnemyBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('enemyBullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 6; self.update = function () { self.y += self.speed; }; return self; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 8; self.shootTimer = 0; self.shootDelay = 10; self.specialAbilityCharges = 3; self.update = function () { if (self.shootTimer > 0) { self.shootTimer--; } }; self.canShoot = function () { return self.shootTimer <= 0; }; self.shoot = function () { if (self.canShoot()) { self.shootTimer = self.shootDelay; return true; } return false; }; self.useSpecialAbility = function () { if (self.specialAbilityCharges > 0) { self.specialAbilityCharges--; return true; } return false; }; return self; }); var PlayerBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('playerBullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -12; self.update = function () { self.y += self.speed; }; return self; }); var PowerUp = Container.expand(function () { var self = Container.call(this); var powerUpGraphics = self.attachAsset('powerUp', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 3; self.type = Math.random() < 0.5 ? 'special' : 'score'; if (self.type === 'special') { powerUpGraphics.tint = 0x00ff00; } self.update = function () { self.y += self.speed; powerUpGraphics.rotation += 0.1; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000011 }); /**** * Game Code ****/ var player = game.addChild(new Player()); player.x = 1024; player.y = 2400; var asteroids = []; var enemies = []; var playerBullets = []; var enemyBullets = []; var powerUps = []; var dragNode = null; var lastPlayerX = player.x; var lastPlayerY = player.y; var asteroidSpawnTimer = 0; var enemySpawnTimer = 0; var powerUpSpawnTimer = 0; var difficultyLevel = 1; // UI Elements var scoreTxt = new Text2('Score: 0', { size: 60, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); var specialAbilityTxt = new Text2('Special: 3', { size: 50, fill: 0x00FF00 }); specialAbilityTxt.anchor.set(0, 0); specialAbilityTxt.x = 120; specialAbilityTxt.y = 100; LK.gui.topLeft.addChild(specialAbilityTxt); function spawnAsteroid() { var asteroid = new Asteroid(); asteroid.x = Math.random() * 1800 + 100; asteroid.y = -100; asteroids.push(asteroid); game.addChild(asteroid); } function spawnEnemy() { var enemy = new Enemy(); enemy.x = Math.random() * 1800 + 100; enemy.y = -100; enemies.push(enemy); game.addChild(enemy); } function spawnPowerUp() { var powerUp = new PowerUp(); powerUp.x = Math.random() * 1800 + 100; powerUp.y = -100; powerUps.push(powerUp); game.addChild(powerUp); } function createPlayerBullet(x, y) { var bullet = new PlayerBullet(); bullet.x = x; bullet.y = y; playerBullets.push(bullet); game.addChild(bullet); LK.getSound('shoot').play(); } function createEnemyBullet(x, y) { var bullet = new EnemyBullet(); bullet.x = x; bullet.y = y; enemyBullets.push(bullet); game.addChild(bullet); } function useSpecialAbility() { if (player.useSpecialAbility()) { // Clear all enemy bullets and damage all enemies for (var i = enemyBullets.length - 1; i >= 0; i--) { enemyBullets[i].destroy(); enemyBullets.splice(i, 1); } // Flash effect LK.effects.flashScreen(0x00ff00, 500); // Damage all enemies for (var i = enemies.length - 1; i >= 0; i--) { enemies[i].destroy(); enemies.splice(i, 1); LK.setScore(LK.getScore() + 100); } specialAbilityTxt.setText('Special: ' + player.specialAbilityCharges); LK.getSound('explosion').play(); } } function handleMove(x, y, obj) { if (dragNode) { dragNode.x = Math.max(40, Math.min(2008, x)); dragNode.y = Math.max(100, Math.min(2632, y)); } } game.move = handleMove; game.down = function (x, y, obj) { dragNode = player; handleMove(x, y, obj); }; game.up = function (x, y, obj) { // Use special ability on tap release if (dragNode && Math.abs(player.x - lastPlayerX) < 20 && Math.abs(player.y - lastPlayerY) < 20) { useSpecialAbility(); } dragNode = null; }; game.update = function () { lastPlayerX = player.x; lastPlayerY = player.y; // Apply TV-style color distortion to player var distortionTime = LK.ticks * 0.05; var redShift = Math.sin(distortionTime + player.x * 0.005) * 0.25; var greenShift = Math.sin(distortionTime * 1.3 + player.y * 0.008) * 0.25; var blueShift = Math.sin(distortionTime * 0.9 + player.x * 0.003) * 0.25; var tintR = Math.floor(150 + redShift * 105); var tintG = Math.floor(150 + greenShift * 105); var tintB = Math.floor(150 + blueShift * 105); player.tint = tintR << 16 | tintG << 8 | tintB; // Update difficulty difficultyLevel = Math.floor(LK.getScore() / 1000) + 1; // Spawn asteroids asteroidSpawnTimer++; if (asteroidSpawnTimer >= Math.max(20, 60 - difficultyLevel * 5)) { spawnAsteroid(); asteroidSpawnTimer = 0; } // Spawn enemies enemySpawnTimer++; if (enemySpawnTimer >= Math.max(60, 120 - difficultyLevel * 10)) { spawnEnemy(); enemySpawnTimer = 0; } // Spawn power-ups powerUpSpawnTimer++; if (powerUpSpawnTimer >= 300) { spawnPowerUp(); powerUpSpawnTimer = 0; } // Player auto-shoot if (player.shoot()) { createPlayerBullet(player.x, player.y - 40); } // Update and check asteroids for (var i = asteroids.length - 1; i >= 0; i--) { var asteroid = asteroids[i]; if (asteroid.lastY === undefined) asteroid.lastY = asteroid.y; // Apply TV-style color distortion var distortionTime = LK.ticks * 0.1; var redShift = Math.sin(distortionTime + asteroid.x * 0.01) * 0.3; var greenShift = Math.sin(distortionTime * 1.2 + asteroid.y * 0.01) * 0.3; var blueShift = Math.sin(distortionTime * 0.8 + asteroid.x * 0.005) * 0.3; var tintR = Math.floor(128 + redShift * 127); var tintG = Math.floor(128 + greenShift * 127); var tintB = Math.floor(128 + blueShift * 127); asteroid.tint = tintR << 16 | tintG << 8 | tintB; // Remove off-screen asteroids if (asteroid.lastY < 2800 && asteroid.y >= 2800) { asteroid.destroy(); asteroids.splice(i, 1); continue; } // Check collision with player if (asteroid.intersects(player)) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); return; } asteroid.lastY = asteroid.y; } // Update and check enemies for (var i = enemies.length - 1; i >= 0; i--) { var enemy = enemies[i]; if (enemy.lastY === undefined) enemy.lastY = enemy.y; // Apply TV-style color distortion to enemies var distortionTime = LK.ticks * 0.08; var redShift = Math.sin(distortionTime * 1.5 + enemy.x * 0.008) * 0.4; var greenShift = Math.sin(distortionTime + enemy.y * 0.012) * 0.4; var blueShift = Math.sin(distortionTime * 0.7 + enemy.x * 0.006) * 0.4; var tintR = Math.floor(100 + redShift * 155); var tintG = Math.floor(100 + greenShift * 155); var tintB = Math.floor(100 + blueShift * 155); enemy.tint = tintR << 16 | tintG << 8 | tintB; // Remove off-screen enemies if (enemy.lastY < 2800 && enemy.y >= 2800) { enemy.destroy(); enemies.splice(i, 1); continue; } // Enemy shooting if (enemy.shoot()) { createEnemyBullet(enemy.x, enemy.y + 30); } // Check collision with player if (enemy.intersects(player)) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); return; } enemy.lastY = enemy.y; } // Update and check player bullets for (var i = playerBullets.length - 1; i >= 0; i--) { var bullet = playerBullets[i]; if (bullet.lastY === undefined) bullet.lastY = bullet.y; // Apply TV-style color distortion to player bullets var distortionTime = LK.ticks * 0.15; var redShift = Math.sin(distortionTime + bullet.x * 0.02) * 0.3; var greenShift = Math.sin(distortionTime * 1.4 + bullet.y * 0.015) * 0.3; var blueShift = Math.sin(distortionTime * 0.8 + bullet.x * 0.01) * 0.3; var tintR = Math.floor(200 + redShift * 55); var tintG = Math.floor(200 + greenShift * 55); var tintB = Math.floor(200 + blueShift * 55); bullet.tint = tintR << 16 | tintG << 8 | tintB; // Remove off-screen bullets if (bullet.lastY > -50 && bullet.y <= -50) { bullet.destroy(); playerBullets.splice(i, 1); continue; } // Check collision with asteroids var hitAsteroid = false; for (var j = asteroids.length - 1; j >= 0; j--) { if (bullet.intersects(asteroids[j])) { bullet.destroy(); playerBullets.splice(i, 1); asteroids[j].destroy(); asteroids.splice(j, 1); LK.setScore(LK.getScore() + 50); scoreTxt.setText('Score: ' + LK.getScore()); LK.getSound('explosion').play(); hitAsteroid = true; break; } } if (hitAsteroid) continue; // Check collision with enemies for (var j = enemies.length - 1; j >= 0; j--) { if (bullet.intersects(enemies[j])) { bullet.destroy(); playerBullets.splice(i, 1); enemies[j].destroy(); enemies.splice(j, 1); LK.setScore(LK.getScore() + 100); scoreTxt.setText('Score: ' + LK.getScore()); LK.getSound('explosion').play(); break; } } bullet.lastY = bullet.y; } // Update and check enemy bullets for (var i = enemyBullets.length - 1; i >= 0; i--) { var bullet = enemyBullets[i]; if (bullet.lastY === undefined) bullet.lastY = bullet.y; // Apply TV-style color distortion to enemy bullets var distortionTime = LK.ticks * 0.18; var redShift = Math.sin(distortionTime * 1.8 + bullet.x * 0.025) * 0.4; var greenShift = Math.sin(distortionTime + bullet.y * 0.018) * 0.4; var blueShift = Math.sin(distortionTime * 0.7 + bullet.x * 0.012) * 0.4; var tintR = Math.floor(180 + redShift * 75); var tintG = Math.floor(180 + greenShift * 75); var tintB = Math.floor(180 + blueShift * 75); bullet.tint = tintR << 16 | tintG << 8 | tintB; // Remove off-screen bullets if (bullet.lastY < 2800 && bullet.y >= 2800) { bullet.destroy(); enemyBullets.splice(i, 1); continue; } // Check collision with player if (bullet.intersects(player)) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); return; } bullet.lastY = bullet.y; } // Update and check power-ups for (var i = powerUps.length - 1; i >= 0; i--) { var powerUp = powerUps[i]; if (powerUp.lastY === undefined) powerUp.lastY = powerUp.y; // Apply TV-style color distortion to power-ups var distortionTime = LK.ticks * 0.12; var redShift = Math.sin(distortionTime * 2 + powerUp.x * 0.015) * 0.5; var greenShift = Math.sin(distortionTime * 1.7 + powerUp.y * 0.02) * 0.5; var blueShift = Math.sin(distortionTime * 0.6 + powerUp.x * 0.01) * 0.5; var tintR = Math.floor(128 + redShift * 127); var tintG = Math.floor(128 + greenShift * 127); var tintB = Math.floor(128 + blueShift * 127); powerUp.tint = tintR << 16 | tintG << 8 | tintB; // Remove off-screen power-ups if (powerUp.lastY < 2800 && powerUp.y >= 2800) { powerUp.destroy(); powerUps.splice(i, 1); continue; } // Check collision with player if (powerUp.intersects(player)) { if (powerUp.type === 'special') { player.specialAbilityCharges = Math.min(5, player.specialAbilityCharges + 1); specialAbilityTxt.setText('Special: ' + player.specialAbilityCharges); } else { LK.setScore(LK.getScore() + 200); scoreTxt.setText('Score: ' + LK.getScore()); } powerUp.destroy(); powerUps.splice(i, 1); LK.getSound('powerup').play(); continue; } powerUp.lastY = powerUp.y; } }; // Start background music LK.playMusic('bgmusic');
===================================================================
--- original.js
+++ change.js
@@ -240,8 +240,17 @@
};
game.update = function () {
lastPlayerX = player.x;
lastPlayerY = player.y;
+ // Apply TV-style color distortion to player
+ var distortionTime = LK.ticks * 0.05;
+ var redShift = Math.sin(distortionTime + player.x * 0.005) * 0.25;
+ var greenShift = Math.sin(distortionTime * 1.3 + player.y * 0.008) * 0.25;
+ var blueShift = Math.sin(distortionTime * 0.9 + player.x * 0.003) * 0.25;
+ var tintR = Math.floor(150 + redShift * 105);
+ var tintG = Math.floor(150 + greenShift * 105);
+ var tintB = Math.floor(150 + blueShift * 105);
+ player.tint = tintR << 16 | tintG << 8 | tintB;
// Update difficulty
difficultyLevel = Math.floor(LK.getScore() / 1000) + 1;
// Spawn asteroids
asteroidSpawnTimer++;
@@ -268,8 +277,17 @@
// Update and check asteroids
for (var i = asteroids.length - 1; i >= 0; i--) {
var asteroid = asteroids[i];
if (asteroid.lastY === undefined) asteroid.lastY = asteroid.y;
+ // Apply TV-style color distortion
+ var distortionTime = LK.ticks * 0.1;
+ var redShift = Math.sin(distortionTime + asteroid.x * 0.01) * 0.3;
+ var greenShift = Math.sin(distortionTime * 1.2 + asteroid.y * 0.01) * 0.3;
+ var blueShift = Math.sin(distortionTime * 0.8 + asteroid.x * 0.005) * 0.3;
+ var tintR = Math.floor(128 + redShift * 127);
+ var tintG = Math.floor(128 + greenShift * 127);
+ var tintB = Math.floor(128 + blueShift * 127);
+ asteroid.tint = tintR << 16 | tintG << 8 | tintB;
// Remove off-screen asteroids
if (asteroid.lastY < 2800 && asteroid.y >= 2800) {
asteroid.destroy();
asteroids.splice(i, 1);
@@ -286,8 +304,17 @@
// Update and check enemies
for (var i = enemies.length - 1; i >= 0; i--) {
var enemy = enemies[i];
if (enemy.lastY === undefined) enemy.lastY = enemy.y;
+ // Apply TV-style color distortion to enemies
+ var distortionTime = LK.ticks * 0.08;
+ var redShift = Math.sin(distortionTime * 1.5 + enemy.x * 0.008) * 0.4;
+ var greenShift = Math.sin(distortionTime + enemy.y * 0.012) * 0.4;
+ var blueShift = Math.sin(distortionTime * 0.7 + enemy.x * 0.006) * 0.4;
+ var tintR = Math.floor(100 + redShift * 155);
+ var tintG = Math.floor(100 + greenShift * 155);
+ var tintB = Math.floor(100 + blueShift * 155);
+ enemy.tint = tintR << 16 | tintG << 8 | tintB;
// Remove off-screen enemies
if (enemy.lastY < 2800 && enemy.y >= 2800) {
enemy.destroy();
enemies.splice(i, 1);
@@ -308,8 +335,17 @@
// Update and check player bullets
for (var i = playerBullets.length - 1; i >= 0; i--) {
var bullet = playerBullets[i];
if (bullet.lastY === undefined) bullet.lastY = bullet.y;
+ // Apply TV-style color distortion to player bullets
+ var distortionTime = LK.ticks * 0.15;
+ var redShift = Math.sin(distortionTime + bullet.x * 0.02) * 0.3;
+ var greenShift = Math.sin(distortionTime * 1.4 + bullet.y * 0.015) * 0.3;
+ var blueShift = Math.sin(distortionTime * 0.8 + bullet.x * 0.01) * 0.3;
+ var tintR = Math.floor(200 + redShift * 55);
+ var tintG = Math.floor(200 + greenShift * 55);
+ var tintB = Math.floor(200 + blueShift * 55);
+ bullet.tint = tintR << 16 | tintG << 8 | tintB;
// Remove off-screen bullets
if (bullet.lastY > -50 && bullet.y <= -50) {
bullet.destroy();
playerBullets.splice(i, 1);
@@ -349,8 +385,17 @@
// Update and check enemy bullets
for (var i = enemyBullets.length - 1; i >= 0; i--) {
var bullet = enemyBullets[i];
if (bullet.lastY === undefined) bullet.lastY = bullet.y;
+ // Apply TV-style color distortion to enemy bullets
+ var distortionTime = LK.ticks * 0.18;
+ var redShift = Math.sin(distortionTime * 1.8 + bullet.x * 0.025) * 0.4;
+ var greenShift = Math.sin(distortionTime + bullet.y * 0.018) * 0.4;
+ var blueShift = Math.sin(distortionTime * 0.7 + bullet.x * 0.012) * 0.4;
+ var tintR = Math.floor(180 + redShift * 75);
+ var tintG = Math.floor(180 + greenShift * 75);
+ var tintB = Math.floor(180 + blueShift * 75);
+ bullet.tint = tintR << 16 | tintG << 8 | tintB;
// Remove off-screen bullets
if (bullet.lastY < 2800 && bullet.y >= 2800) {
bullet.destroy();
enemyBullets.splice(i, 1);
@@ -367,8 +412,17 @@
// Update and check power-ups
for (var i = powerUps.length - 1; i >= 0; i--) {
var powerUp = powerUps[i];
if (powerUp.lastY === undefined) powerUp.lastY = powerUp.y;
+ // Apply TV-style color distortion to power-ups
+ var distortionTime = LK.ticks * 0.12;
+ var redShift = Math.sin(distortionTime * 2 + powerUp.x * 0.015) * 0.5;
+ var greenShift = Math.sin(distortionTime * 1.7 + powerUp.y * 0.02) * 0.5;
+ var blueShift = Math.sin(distortionTime * 0.6 + powerUp.x * 0.01) * 0.5;
+ var tintR = Math.floor(128 + redShift * 127);
+ var tintG = Math.floor(128 + greenShift * 127);
+ var tintB = Math.floor(128 + blueShift * 127);
+ powerUp.tint = tintR << 16 | tintG << 8 | tintB;
// Remove off-screen power-ups
if (powerUp.lastY < 2800 && powerUp.y >= 2800) {
powerUp.destroy();
powerUps.splice(i, 1);
8bit asteroid. In-Game asset. 2d. High contrast. No shadows
8bit enemy. In-Game asset. 2d. High contrast. No shadows
8bit enemyBullet. In-Game asset. 2d. High contrast. No shadows
8bit player aeroplane. In-Game asset. 2d. High contrast. No shadows
8bit powerUp. In-Game asset. 2d. High contrast. No shadows