User prompt
oyuncunun uçağının hareketi biraz daha hızlı olsun ama çok değil
User prompt
sadece bazıları coin düşürsün onları topladığımızda eklensin
User prompt
coinler bazılarından 1 tane çıksın daha fazla çıkmasın
User prompt
ekranın sol altına farklı bir sayaç ekleyelim bu sayaç için Bazı uçaklar coin taşısın ve biz onları vurduğumuzda, coin bakiyemiz kalıcı olarak ekranın sol alt köşesine eklensin. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
The green enemy's bullets should be faster
User prompt
The green enemy's bullets should be slowe
User prompt
make playes plane faster
User prompt
The plane should smoothly and quickly follow the mouse cursor’s position in real-time, without reacting to mouse clicks or moving directly to the clicked location.
User prompt
The player's plane is controlled by the mouse and should continuously follow the position of the cursor on the screen
User prompt
plane was gone and there is no main menu 1 get back air plane 2 make starter menu and put a start button to game start
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'x')' in or related to this line: 'if (Math.abs(self.x - player.x) < 80 && self.shootCooldown <= 0) {' Line Number: 102
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'update')' in or related to this line: 'player.update();' Line Number: 516
User prompt
add main menu
User prompt
make game slower
Code edit (1 edits merged)
Please save this source code
User prompt
Aces of Color: Air Combat Evolution
Initial prompt
In this game, the player takes control of a customizable combat aircraft and engages in fast-paced aerial battles against waves of enemy planes, each uniquely colored and possessing distinct abilities. The core gameplay revolves around maneuvering your plane, avoiding incoming attacks, and strategically destroying enemy aircraft to earn points and progress. Each enemy plane is color-coded to indicate its special behavior or trait. For example: Red planes are aggressive and capable of firing projectiles at the player. Blue planes are extremely fast and harder to hit, requiring quick reflexes. Additional colors may represent other unique characteristics such as defensive shields, evasive movement patterns, or explosive self-destruct attacks. As the player eliminates enemy planes, they earn points. The number of points awarded depends on the color (and therefore difficulty) of the enemy destroyed — each color has a fixed point value. Precision, timing, and strategic targeting will be key to maximizing your score. The player's own aircraft has a health bar and takes damage when hit by enemy fire or when colliding with enemy planes. If the health bar reaches zero, the game ends. At the end of each run, the total score is calculated and converted into an in-game currency. The exchange rate is fixed — for example, every 10 points earned equals 1 unit of currency. This currency can be used in the main menu to: Upgrade the aircraft (e.g., increase speed, firepower, health, or special abilities) Unlock and equip new skins to personalize the look of the plane. The goal is not only to survive and achieve high scores, but also to continuously improve your plane and experiment with different styles and builds, making each playthrough feel fresh and rewarding.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1", { currency: 0, unlockedSkins: ["default"], selectedSkin: "default", upgrades: { fireRate: 0, speed: 0, health: 0 } }); /**** * Classes ****/ // Enemy Base Class var EnemyBase = Container.expand(function () { var self = Container.call(this); self.type = 'base'; self.scoreValue = 1; self.health = 1; self.shootCooldown = 0; self.shootRate = 90; self.speed = 4; self.bulletSpeed = 12; self.lastIntersecting = false; self.lastY = 0; self.takeDamage = function (amount) { self.health -= amount; if (self.health <= 0) { LK.getSound('enemyExplode').play(); LK.setScore(LK.getScore() + self.scoreValue); addCurrency(self.scoreValue); showScorePopup(self.x, self.y, self.scoreValue); self.destroy(); return true; } return false; }; self.shoot = function () { if (self.shootCooldown > 0) return; var bullet = new EnemyBullet(); bullet.x = self.x; bullet.y = self.y + self.height / 2; enemyBullets.push(bullet); game.addChild(bullet); LK.getSound('enemyShoot').play(); self.shootCooldown = self.shootRate; }; self.update = function () { self.y += self.speed; if (self.shootCooldown > 0) self.shootCooldown--; }; return self; }); // Red Attacker: moves straight, shoots at player var EnemyRed = EnemyBase.expand(function () { var self = EnemyBase.call(this); self.type = 'red'; self.scoreValue = 2; self.health = 1; self.shootRate = 80; self.speed = 6; self.asset = self.attachAsset('enemyRed', { anchorX: 0.5, anchorY: 0.5 }); self.width = self.asset.width; self.height = self.asset.height; self.update = function () { self.y += self.speed; if (self.shootCooldown > 0) self.shootCooldown--; // Shoot if player is roughly aligned if (Math.abs(self.x - player.x) < 80 && self.shootCooldown <= 0) { self.shoot(); } }; return self; }); // Green Tank: slow, high health, shoots var EnemyGreen = EnemyBase.expand(function () { var self = EnemyBase.call(this); self.type = 'green'; self.scoreValue = 5; self.health = 3; self.shootRate = 60; self.speed = 3.5; self.asset = self.attachAsset('enemyGreen', { anchorX: 0.5, anchorY: 0.5 }); self.width = self.asset.width; self.height = self.asset.height; self.update = function () { self.y += self.speed; if (self.shootCooldown > 0) self.shootCooldown--; // Shoots more often if (self.shootCooldown <= 0) { self.shoot(); } }; return self; }); // Blue Speedster: zig-zags, no shooting var EnemyBlue = EnemyBase.expand(function () { var self = EnemyBase.call(this); self.type = 'blue'; self.scoreValue = 3; self.health = 1; self.shootRate = 9999; self.speed = 8; self.asset = self.attachAsset('enemyBlue', { anchorX: 0.5, anchorY: 0.5 }); self.width = self.asset.width; self.height = self.asset.height; self.zigzagDir = Math.random() > 0.5 ? 1 : -1; self.zigzagSpeed = 7 + Math.random() * 3; self.zigzagPhase = Math.random() * 100; self.update = function () { self.y += self.speed; self.x += Math.sin((LK.ticks + self.zigzagPhase) / 18) * self.zigzagSpeed * self.zigzagDir; }; return self; }); // Enemy Bullet var EnemyBullet = Container.expand(function () { var self = Container.call(this); var bullet = self.attachAsset('enemyBullet', { anchorX: 0.5, anchorY: 0.5 }); self.width = bullet.width; self.height = bullet.height; self.speed = 8; self.update = function () { self.y += self.speed; }; return self; }); // Player Bullet var PlayerBullet = Container.expand(function () { var self = Container.call(this); var bullet = self.attachAsset('playerBullet', { anchorX: 0.5, anchorY: 0.5 }); self.width = bullet.width; self.height = bullet.height; self.speed = -16 - (storage.upgrades && storage.upgrades.fireRate ? storage.upgrades.fireRate * 1 : 0); self.update = function () { self.y += self.speed; }; return self; }); // Player Plane var PlayerPlane = Container.expand(function () { var self = Container.call(this); // Attach player plane asset self.skin = storage.selectedSkin || 'default'; self.plane = self.attachAsset('playerPlane', { anchorX: 0.5, anchorY: 0.5 }); self.width = self.plane.width; self.height = self.plane.height; self.fireCooldown = 0; self.baseFireRate = 30; // ticks between shots self.baseSpeed = 10; self.baseHealth = 5; self.maxHealth = self.baseHealth + (storage.upgrades && storage.upgrades.health ? storage.upgrades.health : 0); self.health = self.maxHealth; self.updateSkin = function () { // For future: swap asset based on skin // For now, only color changes if (self.skin === 'default') { self.plane.tint = 0x888888; } else if (self.skin === 'gold') { self.plane.tint = 0xffd700; } else if (self.skin === 'blue') { self.plane.tint = 0x2a6edb; } }; self.shoot = function () { if (self.fireCooldown > 0) return; var bullet = new PlayerBullet(); bullet.x = self.x; bullet.y = self.y - self.height / 2 + 10; playerBullets.push(bullet); game.addChild(bullet); LK.getSound('playerShoot').play(); self.fireCooldown = self.baseFireRate - (storage.upgrades && storage.upgrades.fireRate ? storage.upgrades.fireRate * 4 : 0); if (self.fireCooldown < 8) self.fireCooldown = 8; }; self.takeDamage = function (amount) { self.health -= amount; if (self.health < 0) self.health = 0; LK.effects.flashObject(self, 0xff0000, 200); LK.getSound('playerHit').play(); updateHealthBar(); if (self.health <= 0) { LK.effects.flashScreen(0xff0000, 800); LK.showGameOver(); } }; self.heal = function (amount) { self.health += amount; if (self.health > self.maxHealth) self.health = self.maxHealth; updateHealthBar(); }; self.update = function () { if (self.fireCooldown > 0) self.fireCooldown--; }; self.updateSkin(); return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x1a1a2a }); /**** * Game Code ****/ // Music // Sounds // Coin icon // Health bar foreground // Health bar background // Enemy bullet (red) // Enemy: Green Tank // Enemy: Blue Speedster // Enemy: Red Attacker // Player bullet (yellow) // Player plane (default skin: gray) // --- Global Variables --- var player; var playerBullets = []; var enemies = []; var enemyBullets = []; var spawnTimer = 0; var spawnInterval = 60; var dragNode = null; var lastPlayerX = 0; var lastPlayerY = 0; var healthBarBg, healthBarFg; var scoreTxt, coinTxt, coinIcon; var currency = storage.currency || 0; // --- Main Menu Overlay --- var mainMenuOverlay = new Container(); mainMenuOverlay.visible = true; // Title var titleTxt = new Text2("Aces of Color", { size: 180, fill: "#fff" }); titleTxt.anchor.set(0.5, 0); titleTxt.x = 2048 / 2; titleTxt.y = 320; mainMenuOverlay.addChild(titleTxt); // Currency display var menuCoinIcon = LK.getAsset('coin', { anchorX: 0.5, anchorY: 0.5 }); menuCoinIcon.x = 2048 / 2 - 120; menuCoinIcon.y = 600; mainMenuOverlay.addChild(menuCoinIcon); var menuCoinTxt = new Text2(currency + '', { size: 100, fill: 0xFFD700 }); menuCoinTxt.anchor.set(0, 0.5); menuCoinTxt.x = 2048 / 2 - 60; menuCoinTxt.y = 600; mainMenuOverlay.addChild(menuCoinTxt); // Play button var playBtn = new Text2("PLAY", { size: 160, fill: 0x44FF44 }); playBtn.anchor.set(0.5, 0.5); playBtn.x = 2048 / 2; playBtn.y = 900; mainMenuOverlay.addChild(playBtn); // Skin/upgrade info (simple text for now) var skinTxt = new Text2("Skin: " + (storage.selectedSkin || "default"), { size: 80, fill: "#aaa" }); skinTxt.anchor.set(0.5, 0.5); skinTxt.x = 2048 / 2; skinTxt.y = 1100; mainMenuOverlay.addChild(skinTxt); var upgradeTxt = new Text2("Upgrades - Fire: " + (storage.upgrades && storage.upgrades.fireRate ? storage.upgrades.fireRate : 0) + " Speed: " + (storage.upgrades && storage.upgrades.speed ? storage.upgrades.speed : 0) + " Health: " + (storage.upgrades && storage.upgrades.health ? storage.upgrades.health : 0), { size: 70, fill: "#aaa" }); upgradeTxt.anchor.set(0.5, 0.5); upgradeTxt.x = 2048 / 2; upgradeTxt.y = 1200; mainMenuOverlay.addChild(upgradeTxt); // Add overlay to GUI center LK.gui.center.addChild(mainMenuOverlay); // Play button interaction playBtn.interactive = true; playBtn.buttonMode = true; playBtn.down = function (x, y, obj) { mainMenuOverlay.visible = false; startGame(); }; // --- GUI Elements --- scoreTxt = new Text2('0', { size: 100, fill: "#fff" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); coinIcon = LK.getAsset('coin', { anchorX: 0.5, anchorY: 0.5 }); coinIcon.x = 0; coinIcon.y = 0; LK.gui.topRight.addChild(coinIcon); coinTxt = new Text2(currency + '', { size: 80, fill: 0xFFD700 }); coinTxt.anchor.set(0, 0.5); coinTxt.x = 40; coinTxt.y = 0; LK.gui.topRight.addChild(coinTxt); // Health bar healthBarBg = LK.getAsset('healthBarBg', { anchorX: 0, anchorY: 0.5 }); healthBarBg.x = 200; healthBarBg.y = 120; LK.gui.top.addChild(healthBarBg); healthBarFg = LK.getAsset('healthBarFg', { anchorX: 0, anchorY: 0.5 }); healthBarFg.x = 200; healthBarFg.y = 120; LK.gui.top.addChild(healthBarFg); function updateHealthBar() { var ratio = player.health / player.maxHealth; if (ratio < 0) ratio = 0; healthBarFg.width = 600 * ratio; } // --- Player Initialization --- // Only start game after pressing play function startGame() { // Reset all game state playerBullets = []; enemies = []; enemyBullets = []; spawnTimer = 0; spawnInterval = 60; dragNode = null; lastPlayerX = 0; lastPlayerY = 0; LK.setScore(0); // Remove any existing player if (player && player.parent) player.destroy(); player = new PlayerPlane(); player.x = 2048 / 2; player.y = 2732 - 350; game.addChild(player); updateHealthBar(); // Show GUI scoreTxt.visible = true; coinIcon.visible = true; coinTxt.visible = true; healthBarBg.visible = true; healthBarFg.visible = true; } // Hide GUI until game starts scoreTxt.visible = false; coinIcon.visible = false; coinTxt.visible = false; healthBarBg.visible = false; healthBarFg.visible = false; // --- Utility Functions --- function addCurrency(amount) { currency += amount; storage.currency = currency; coinTxt.setText(currency + ''); LK.getSound('coin').play(); } function showScorePopup(x, y, value) { var popup = new Text2('+' + value, { size: 70, fill: "#fff" }); popup.anchor.set(0.5, 0.5); popup.x = x; popup.y = y; game.addChild(popup); tween(popup, { y: y - 100, alpha: 0 }, { duration: 900, easing: tween.easeOut, onFinish: function onFinish() { popup.destroy(); } }); } // --- Enemy Spawning --- function spawnEnemy() { var r = Math.random(); var enemy; if (r < 0.5) { enemy = new EnemyRed(); } else if (r < 0.8) { enemy = new EnemyBlue(); } else { enemy = new EnemyGreen(); } enemy.x = 180 + Math.random() * (2048 - 360); enemy.y = -enemy.height / 2; enemies.push(enemy); game.addChild(enemy); } // --- Game Move/Touch Controls --- function handleMove(x, y, obj) { if (dragNode) { // Clamp to game area var minX = player.width / 2 + 40; var maxX = 2048 - player.width / 2 - 40; var minY = 200 + player.height / 2; var maxY = 2732 - player.height / 2 - 40; dragNode.x = x; dragNode.y = y; if (dragNode.x < minX) dragNode.x = minX; if (dragNode.x > maxX) dragNode.x = maxX; if (dragNode.y < minY) dragNode.y = minY; if (dragNode.y > maxY) dragNode.y = maxY; } } game.move = handleMove; game.down = function (x, y, obj) { // Only start drag if touch is not in top left 100x100 if (!(x < 100 && y < 100)) { dragNode = player; handleMove(x, y, obj); } }; game.up = function (x, y, obj) { dragNode = null; }; // --- Game Update Loop --- game.update = function () { // Player update if (player && typeof player.update === "function") { player.update(); // Player auto-shoot if (LK.ticks % 5 === 0) { player.shoot(); } } // Player bullets for (var i = playerBullets.length - 1; i >= 0; i--) { var b = playerBullets[i]; b.update(); // Remove if off screen if (b.y < -50) { b.destroy(); playerBullets.splice(i, 1); continue; } // Check collision with enemies for (var j = enemies.length - 1; j >= 0; j--) { var e = enemies[j]; if (b.intersects(e)) { var killed = e.takeDamage(1); b.destroy(); playerBullets.splice(i, 1); if (killed) { e.destroy(); enemies.splice(j, 1); } break; } } } // Enemy bullets for (var i = enemyBullets.length - 1; i >= 0; i--) { var b = enemyBullets[i]; b.update(); if (b.y > 2732 + 50) { b.destroy(); enemyBullets.splice(i, 1); continue; } // Check collision with player if (b.intersects(player)) { player.takeDamage(1); b.destroy(); enemyBullets.splice(i, 1); continue; } } // Enemies for (var i = enemies.length - 1; i >= 0; i--) { var e = enemies[i]; e.update(); // Remove if off screen if (e.y > 2732 + 100) { e.destroy(); enemies.splice(i, 1); continue; } // Check collision with player if (e.intersects(player)) { player.takeDamage(2); LK.effects.flashObject(e, 0xff0000, 200); e.destroy(); enemies.splice(i, 1); continue; } } // Enemy spawn logic: increase spawn rate over time if (spawnTimer <= 0) { spawnEnemy(); spawnInterval = 60 - Math.floor(LK.getScore() / 10) * 4; if (spawnInterval < 18) spawnInterval = 18; spawnTimer = spawnInterval; } else { spawnTimer--; } // Update score scoreTxt.setText(LK.getScore()); // Win condition: none (endless), but could be added }; // --- Music --- LK.playMusic('bgmusic', { fade: { start: 0, end: 1, duration: 1200 } }); // --- Game Over Handler (currency gain) --- LK.on('gameover', function () { // Add score to currency addCurrency(LK.getScore()); // Save currency storage.currency = currency; coinTxt.setText(currency + ''); // Show main menu overlay again mainMenuOverlay.visible = true; // Hide GUI until next play scoreTxt.visible = false; coinIcon.visible = false; coinTxt.visible = false; healthBarBg.visible = false; healthBarFg.visible = false; // Update menu currency and upgrades menuCoinTxt.setText(currency + ''); skinTxt.setText("Skin: " + (storage.selectedSkin || "default")); upgradeTxt.setText("Upgrades - Fire: " + (storage.upgrades && storage.upgrades.fireRate ? storage.upgrades.fireRate : 0) + " Speed: " + (storage.upgrades && storage.upgrades.speed ? storage.upgrades.speed : 0) + " Health: " + (storage.upgrades && storage.upgrades.health ? storage.upgrades.health : 0)); // Remove all enemies and bullets from game for (var i = 0; i < enemies.length; i++) if (enemies[i].parent) enemies[i].destroy(); for (var i = 0; i < playerBullets.length; i++) if (playerBullets[i].parent) playerBullets[i].destroy(); for (var i = 0; i < enemyBullets.length; i++) if (enemyBullets[i].parent) enemyBullets[i].destroy(); enemies = []; playerBullets = []; enemyBullets = []; // Remove player if (player && player.parent) player.destroy(); // Reset score LK.setScore(0); // Reset spawn timer spawnTimer = 0; spawnInterval = 60; dragNode = null; lastPlayerX = 0; lastPlayerY = 0; // (Upgrades/skins not reset here) }); // --- YouWin Handler (not used, but for future) --- LK.on('youwin', function () { // Could reward bonus currency, etc. }); // --- Prevent elements in top left 100x100 // (All GUI elements are placed away from top left, and player cannot move there)
===================================================================
--- original.js
+++ change.js
@@ -463,12 +463,14 @@
};
// --- Game Update Loop ---
game.update = function () {
// Player update
- player.update();
- // Player auto-shoot
- if (LK.ticks % 5 === 0) {
- player.shoot();
+ if (player && typeof player.update === "function") {
+ player.update();
+ // Player auto-shoot
+ if (LK.ticks % 5 === 0) {
+ player.shoot();
+ }
}
// Player bullets
for (var i = playerBullets.length - 1; i >= 0; i--) {
var b = playerBullets[i];
coin. In-Game asset. 2d. High contrast. No shadows
mavi ufo. In-Game asset. 2d. High contrast. No shadows
bir mermi ama ters . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
yeşil 2d pixel simetrik uçak In-Game asset. 2d. High contrast. No shadows
kırmızı 2d pixel simetrik uçak In-Game asset. 2d. High contrast. No shadows
gri 2d piksel yüksek techizatlı uçak. In-Game asset. 2d. High contrast. No shadows
mermi. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat