User prompt
Delete the text tap to aim and shoot flying birds! and replace it with "Tap to aim and shoot Drone!" and change the color to white
User prompt
center the texts at the top and make them white
User prompt
Remove mountain1,mountain2,mountain3,lake,sun,tree,trunk and add background instead
Remix started
Copy Modern Commander: Base Defense
/****
* Classes
****/
var Bird = Container.expand(function (birdType) {
var self = Container.call(this);
// Set bird type (1-6)
self.birdType = birdType || Math.floor(Math.random() * 6) + 1;
var assetName = 'bird' + self.birdType;
var birdGraphics = self.attachAsset(assetName, {
anchorX: 0.5,
anchorY: 0.5
});
// Different properties for each bird type
var birdConfigs = {
1: {
speedMultiplier: 1.0,
bounceChance: 0.8,
points: 5,
color: 0xffffff
},
2: {
speedMultiplier: 0.7,
bounceChance: 0.9,
points: 5,
color: 0x8B4513
},
// Eagle - slower, more points
3: {
speedMultiplier: 1.5,
bounceChance: 0.6,
points: 5,
color: 0x654321
},
// Sparrow - fast, bonus points
4: {
speedMultiplier: 0.5,
bounceChance: 0.95,
points: 5,
color: 0x2F4F4F
},
// Hawk - slow, high points
5: {
speedMultiplier: 2.0,
bounceChance: 0.4,
points: 5,
color: 0xFF6347
},
// Robin - very fast, highest points
6: {
speedMultiplier: 1.2,
bounceChance: 0.7,
points: 5,
color: 0x000000
} // Crow - medium speed
};
var config = birdConfigs[self.birdType];
birdGraphics.tint = config.color;
self.speedX = (Math.random() * 4 + 2) * config.speedMultiplier * (Math.random() > 0.5 ? 1 : -1);
self.speedY = (Math.random() * 2 - 1) * config.speedMultiplier;
self.bounceChance = config.bounceChance;
self.points = config.points;
self.lastX = 0;
self.lastY = 0;
self.update = function () {
self.lastX = self.x;
self.lastY = self.y;
self.x += self.speedX;
self.y += self.speedY;
// Bounce off top and bottom with chance based on bird type
if (self.y < 100 || self.y > 2632) {
if (Math.random() < self.bounceChance) {
self.speedY *= -1;
}
}
};
return self;
});
var Bullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.attachAsset('bullet', {
anchorX: 0.5,
anchorY: 0.5
});
self.speedX = 0;
self.speedY = 0;
self.lastX = 0;
self.lastY = 0;
self.update = function () {
self.lastX = self.x;
self.lastY = self.y;
self.x += self.speedX;
self.y += self.speedY;
};
return self;
});
var Feather = Container.expand(function (x, y, birdTint, featherType) {
var self = Container.call(this);
var featherGraphics = self.attachAsset('feather', {
anchorX: 0.5,
anchorY: 0.5
});
// Set feather type (1, 2, or 3)
self.featherType = featherType || 1;
// Set feather color similar to bird
featherGraphics.tint = birdTint || 0xffffff;
// Different properties for each feather type
if (self.featherType === 1) {
// Type 1: Normal feathers - medium speed, medium life
self.x = x + (Math.random() - 0.5) * 40;
self.y = y + (Math.random() - 0.5) * 40;
self.speedX = (Math.random() - 0.5) * 8;
self.speedY = Math.random() * -6 - 2;
self.gravity = 0.2;
self.rotation = Math.random() * Math.PI * 2;
self.rotationSpeed = (Math.random() - 0.5) * 0.3;
self.lifeTime = 0;
self.maxLifeTime = 120; // 2 seconds at 60fps
featherGraphics.scaleX = 1.0;
featherGraphics.scaleY = 1.0;
} else if (self.featherType === 2) {
// Type 2: Small fast feathers - faster speed, shorter life
self.x = x + (Math.random() - 0.5) * 60;
self.y = y + (Math.random() - 0.5) * 60;
self.speedX = (Math.random() - 0.5) * 12;
self.speedY = Math.random() * -10 - 3;
self.gravity = 0.15;
self.rotation = Math.random() * Math.PI * 2;
self.rotationSpeed = (Math.random() - 0.5) * 0.5;
self.lifeTime = 0;
self.maxLifeTime = 90; // 1.5 seconds at 60fps
featherGraphics.scaleX = 0.7;
featherGraphics.scaleY = 0.7;
} else {
// Type 3: Large slow feathers - slower speed, longer life
self.x = x + (Math.random() - 0.5) * 20;
self.y = y + (Math.random() - 0.5) * 20;
self.speedX = (Math.random() - 0.5) * 4;
self.speedY = Math.random() * -3 - 1;
self.gravity = 0.25;
self.rotation = Math.random() * Math.PI * 2;
self.rotationSpeed = (Math.random() - 0.5) * 0.2;
self.lifeTime = 0;
self.maxLifeTime = 180; // 3 seconds at 60fps
featherGraphics.scaleX = 1.4;
featherGraphics.scaleY = 1.4;
}
self.update = function () {
self.speedY += self.gravity;
self.x += self.speedX;
self.y += self.speedY;
self.rotation += self.rotationSpeed;
self.lifeTime++;
// Fade out over time
self.alpha = 1 - self.lifeTime / self.maxLifeTime;
};
return self;
});
var Gun = Container.expand(function () {
var self = Container.call(this);
var gunGraphics = self.attachAsset('gun', {
anchorX: 0.5,
anchorY: 1.0
});
self.targetX = 0;
self.targetY = 0;
self.aimAt = function (x, y) {
self.targetX = x;
self.targetY = y;
var dx = x - self.x;
var dy = y - self.y;
var angle = Math.atan2(dy, dx);
gunGraphics.rotation = angle + Math.PI / 2;
};
return self;
});
var Raindrop = Container.expand(function (x, y) {
var self = Container.call(this);
var raindropGraphics = self.attachAsset('bullet', {
anchorX: 0.5,
anchorY: 0.5
});
// Make raindrop smaller and blue-ish
raindropGraphics.scaleX = 0.3;
raindropGraphics.scaleY = 0.6;
raindropGraphics.tint = 0x4169E1;
raindropGraphics.alpha = 0.7;
self.x = x;
self.y = y;
self.speedY = Math.random() * 3 + 4; // Falling speed
self.speedX = (Math.random() - 0.5) * 2; // Slight horizontal drift
self.lifeTime = 0;
self.maxLifeTime = 300; // 5 seconds at 60fps
self.update = function () {
self.y += self.speedY;
self.x += self.speedX;
self.lifeTime++;
// Fade out over time
if (self.lifeTime > self.maxLifeTime * 0.8) {
self.alpha = 0.7 * (1 - (self.lifeTime - self.maxLifeTime * 0.8) / (self.maxLifeTime * 0.2));
}
};
return self;
});
/****
* Initialize Game
****/
// Game variables
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
// Game variables
var birds = [];
var bullets = [];
var guns = [];
var feathers = [];
var lastBirdSpawn = 0;
var gameStarted = false;
var bulletsPerShot = 1;
var gunCount = 1;
var lastScoreCheckpoint = 0;
var health = 20;
var clouds = [];
var raindrops = [];
var currentWave = 1;
var maxWaves = 5;
var currentChapter = 1;
var maxChapters = 100;
var birdsKilledThisWave = 0;
var birdsNeededPerWave = [10, 15, 20, 25, 30]; // Birds needed to complete each wave
var waveStarted = false;
// Enemy types for each 5-chapter group
var enemyTypesByChapter = [[1],
// Chapters 1-5: bird 1
[2],
// Chapters 6-10: bird 2
[3],
// Chapters 11-15: bird 3
[4],
// Chapters 16-20: bird 4
[5],
// Chapters 21-25: bird 5
[6],
// Chapters 26-30: bird 6
[1, 2],
// Chapters 31-35: birds 1-2
[2, 3],
// Chapters 36-40: birds 2-3
[3, 4],
// Chapters 41-45: birds 3-4
[4, 5],
// Chapters 46-50: birds 4-5
[5, 6],
// Chapters 51-55: birds 5-6
[1, 3],
// Chapters 56-60: birds 1,3
[2, 4],
// Chapters 61-65: birds 2,4
[3, 5],
// Chapters 66-70: birds 3,5
[4, 6],
// Chapters 71-75: birds 4,6
[1, 2, 3],
// Chapters 76-80: birds 1-3
[3, 4, 5],
// Chapters 81-85: birds 3-5
[4, 5, 6],
// Chapters 86-90: birds 4-6
[1, 2, 3, 4, 5, 6] // Chapters 91-100: all birds
];
// Create background image
var background = game.addChild(LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5
}));
background.x = 1024;
background.y = 1366;
// Create clouds
for (var c = 0; c < 5; c++) {
var cloud = game.addChild(LK.getAsset('cloud', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.8 + Math.random() * 0.6,
scaleY: 0.8 + Math.random() * 0.6
}));
cloud.x = Math.random() * 2048;
cloud.y = Math.random() * 400 + 100;
cloud.speedX = (Math.random() * 2 + 1) * (Math.random() > 0.5 ? 1 : -1);
cloud.alpha = 0.7;
clouds.push(cloud);
}
// Create initial gun at bottom center
function createGun(index) {
var gun = game.addChild(new Gun());
var spacing = 2048 / (gunCount + 1);
gun.x = spacing * (index + 1);
gun.y = 2600;
return gun;
}
// Initialize first gun
guns.push(createGun(0));
// Score display
var scoreTxt = new Text2('Score: 0', {
size: 80,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Health display
var healthTxt = new Text2('Health: 20', {
size: 80,
fill: 0xFF0000
});
healthTxt.anchor.set(0.5, 0);
healthTxt.y = 120;
LK.gui.top.addChild(healthTxt);
// Wave display
var waveTxt = new Text2('Chapter: 1/100 - Wave: 1/5 (0/10)', {
size: 60,
fill: 0x00FF00
});
waveTxt.anchor.set(0.5, 0);
waveTxt.y = 200;
LK.gui.top.addChild(waveTxt);
// Instructions
var instructionTxt = new Text2('Tap to aim and shoot flying birds!', {
size: 60,
fill: 0xFFFF00
});
instructionTxt.anchor.set(0.5, 0.5);
instructionTxt.x = 1024;
instructionTxt.y = 1366;
game.addChild(instructionTxt);
// Remove instructions after 3 seconds
LK.setTimeout(function () {
if (instructionTxt.parent) {
instructionTxt.destroy();
}
}, 3000);
// Game controls
game.down = function (x, y, obj) {
if (!gameStarted) {
// Start background music when game begins
LK.playMusic('background_music');
}
gameStarted = true;
// Each gun fires multiple bullets
for (var g = 0; g < guns.length; g++) {
var gun = guns[g];
// Aim gun
gun.aimAt(x, y);
// Fire multiple bullets per gun
for (var b = 0; b < bulletsPerShot; b++) {
var bullet = game.addChild(new Bullet());
bullet.x = gun.x;
bullet.y = gun.y - 60;
bullet.lastX = bullet.x;
bullet.lastY = bullet.y;
// Calculate bullet direction with slight spread for multiple bullets
var dx = x - gun.x;
var dy = y - gun.y;
var distance = Math.sqrt(dx * dx + dy * dy);
var speed = 60;
// Add spread for multiple bullets
var spreadAngle = (b - (bulletsPerShot - 1) / 2) * 0.2;
var angle = Math.atan2(dy, dx) + spreadAngle;
bullet.speedX = Math.cos(angle) * speed;
bullet.speedY = Math.sin(angle) * speed;
bullets.push(bullet);
}
}
// Play shoot sound
LK.getSound('gun_shoot').play();
};
// Spawn birds periodically
function spawnBird() {
// Get available enemy types for current chapter
var chapterGroup = Math.min(Math.floor((currentChapter - 1) / 5), 19);
var availableEnemies = enemyTypesByChapter[chapterGroup];
// Create random bird type from available enemies for this chapter
var randomIndex = Math.floor(Math.random() * availableEnemies.length);
var randomBirdType = availableEnemies[randomIndex];
var bird = game.addChild(new Bird(randomBirdType));
// Random spawn from sides
if (Math.random() > 0.5) {
bird.x = -50;
bird.speedX = Math.abs(bird.speedX);
} else {
bird.x = 2098;
bird.speedX = -Math.abs(bird.speedX);
}
bird.y = Math.random() * 1500 + 200;
bird.lastX = bird.x;
bird.lastY = bird.y;
birds.push(bird);
}
// Main game update
game.update = function () {
if (!gameStarted) return;
// Check wave completion
if (birdsKilledThisWave >= birdsNeededPerWave[currentWave - 1]) {
if (currentWave >= maxWaves) {
// Chapter completed
LK.getSound('chapter_complete').play();
if (currentChapter >= maxChapters) {
// All chapters completed - player wins!
LK.showYouWin();
return;
} else {
// Move to next chapter
currentChapter++;
currentWave = 1;
birdsKilledThisWave = 0;
waveStarted = false;
// Reset health for new chapter
health = 20;
healthTxt.setText('Health: ' + health);
}
} else {
// Move to next wave
LK.getSound('wave_complete').play();
currentWave++;
birdsKilledThisWave = 0;
waveStarted = false;
// Wave upgrades
if (currentWave === 2 && guns.length < 2) {
gunCount++;
guns.push(createGun(guns.length));
}
if (currentWave === 3 && bulletsPerShot < 2) {
bulletsPerShot++;
}
if (currentWave === 4 && guns.length < 2) {
gunCount++;
if (guns.length < 2) guns.push(createGun(guns.length));
}
if (currentWave === 5 && bulletsPerShot < 3) {
bulletsPerShot++;
}
}
}
// Update wave display
waveTxt.setText('Chapter: ' + currentChapter + '/' + maxChapters + ' - Wave: ' + currentWave + '/' + maxWaves + ' (' + birdsKilledThisWave + '/' + birdsNeededPerWave[currentWave - 1] + ')');
// Spawn birds based on current wave (higher waves spawn faster)
var spawnDelay = Math.max(15, 40 - currentWave * 5);
if (LK.ticks - lastBirdSpawn > spawnDelay) {
spawnBird();
lastBirdSpawn = LK.ticks;
waveStarted = true;
}
// Update and check birds
for (var i = birds.length - 1; i >= 0; i--) {
var bird = birds[i];
// Remove birds that flew off screen and decrease health
if (bird.lastX >= -100 && bird.x < -100) {
health--;
healthTxt.setText('Health: ' + health);
// Play health warning sound when health gets low
if (health <= 5) {
LK.getSound('health_warning').play();
}
bird.destroy();
birds.splice(i, 1);
if (health <= 0) {
LK.showGameOver();
return;
}
continue;
}
if (bird.lastX <= 2148 && bird.x > 2148) {
health--;
healthTxt.setText('Health: ' + health);
// Play health warning sound when health gets low
if (health <= 5) {
LK.getSound('health_warning').play();
}
bird.destroy();
birds.splice(i, 1);
if (health <= 0) {
LK.showGameOver();
return;
}
continue;
}
}
// Update clouds
for (var c = 0; c < clouds.length; c++) {
var cloud = clouds[c];
cloud.x += cloud.speedX * 0.5;
// Wrap clouds around screen
if (cloud.x > 2148) {
cloud.x = -100;
} else if (cloud.x < -100) {
cloud.x = 2148;
}
}
// Update and cleanup raindrops
for (var r = raindrops.length - 1; r >= 0; r--) {
var raindrop = raindrops[r];
// Remove raindrops that fall off screen or exceed lifetime
if (raindrop.y > 2782 || raindrop.lifeTime >= raindrop.maxLifeTime || raindrop.alpha <= 0) {
raindrop.destroy();
raindrops.splice(r, 1);
}
}
// Update and check bullets
for (var j = bullets.length - 1; j >= 0; j--) {
var bullet = bullets[j];
// Remove bullets that go off screen
if (bullet.x < -50 || bullet.x > 2098 || bullet.y < -50 || bullet.y > 2782) {
bullet.destroy();
bullets.splice(j, 1);
continue;
}
// Check bullet-bird collisions
for (var k = birds.length - 1; k >= 0; k--) {
var bird = birds[k];
if (bullet.intersects(bird)) {
// Hit! Award 5 points for each hit
LK.setScore(LK.getScore() + 5);
scoreTxt.setText('Score: ' + LK.getScore());
// Increment wave kill counter
birdsKilledThisWave++;
// Play enemy hit sound
LK.getSound('enemy_hit').play();
// Create feather explosion with 3 different types
var featherCount = 10 + Math.floor(Math.random() * 5); // 10-15 feathers (half of previous amount)
for (var f = 0; f < featherCount; f++) {
// Randomly choose feather type (1, 2, or 3)
var featherType = Math.floor(Math.random() * 3) + 1;
var feather = game.addChild(new Feather(bird.x, bird.y, bird.children[0].tint, featherType));
feathers.push(feather);
}
// Flash bird and remove
LK.effects.flashObject(bird, 0xff0000, 200);
// Remove bullet and bird
bullet.destroy();
bullets.splice(j, 1);
bird.destroy();
birds.splice(k, 1);
break;
}
}
// Update and cleanup feathers
for (var f = feathers.length - 1; f >= 0; f--) {
var feather = feathers[f];
if (feather.lifeTime >= feather.maxLifeTime || feather.alpha <= 0) {
feather.destroy();
feathers.splice(f, 1);
}
}
}
}; ===================================================================
--- original.js
+++ change.js
@@ -271,15 +271,15 @@
[4, 5, 6],
// Chapters 86-90: birds 4-6
[1, 2, 3, 4, 5, 6] // Chapters 91-100: all birds
];
-// Create sun
-var sun = game.addChild(LK.getAsset('sun', {
+// Create background image
+var background = game.addChild(LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5
}));
-sun.x = 1800;
-sun.y = 300;
+background.x = 1024;
+background.y = 1366;
// Create clouds
for (var c = 0; c < 5; c++) {
var cloud = game.addChild(LK.getAsset('cloud', {
anchorX: 0.5,
@@ -292,53 +292,8 @@
cloud.speedX = (Math.random() * 2 + 1) * (Math.random() > 0.5 ? 1 : -1);
cloud.alpha = 0.7;
clouds.push(cloud);
}
-// Create mountains in background
-var mountains = [];
-for (var m = 0; m < 6; m++) {
- var mountainType = m % 3 + 1;
- var mountain = game.addChild(LK.getAsset('mountain' + mountainType, {
- anchorX: 0.5,
- anchorY: 1.0
- }));
- mountain.x = m * 350 + 200;
- mountain.y = 2400;
- mountain.alpha = 0.6;
- mountains.push(mountain);
-}
-// Create lake
-var lake = game.addChild(LK.getAsset('lake', {
- anchorX: 0.5,
- anchorY: 1.0
-}));
-lake.x = 1024;
-lake.y = 2500;
-lake.alpha = 0.7;
-// Create trees in foreground
-var trees = [];
-for (var t = 0; t < 8; t++) {
- // Create tree trunk
- var trunk = game.addChild(LK.getAsset('trunk', {
- anchorX: 0.5,
- anchorY: 1.0
- }));
- trunk.x = t * 250 + 150 + Math.random() * 100;
- trunk.y = 2550;
- // Create tree foliage
- var tree = game.addChild(LK.getAsset('tree', {
- anchorX: 0.5,
- anchorY: 1.0
- }));
- tree.x = trunk.x;
- tree.y = trunk.y - 35;
- tree.scaleX = 0.8 + Math.random() * 0.4;
- tree.scaleY = 0.8 + Math.random() * 0.4;
- trees.push({
- trunk: trunk,
- tree: tree
- });
-}
// Create initial gun at bottom center
function createGun(index) {
var gun = game.addChild(new Gun());
var spacing = 2048 / (gunCount + 1);
bulut. In-Game asset. 2d. High contrast. No shadows
Military quadcopter side view In-Game asset. 2d. High contrast. No shadows
fixed anti-aircraft air defense system, rocket launcher, missiles vertically In-Game asset. 2d. High contrast. No shadows
only green missiles with white caps, same as in the image, only one
World War II chaotic background, grey In-Game asset. 2d. High contrast. No shadows
explosion In-Game asset. 2d. High contrast. No shadows
Military quadcopter side view In-Game asset. 2d. High contrast. No shadows
Modern App Store icon, high definition, square with rounded corners, for a game titled "Drone WW2". In-Game asset. 2d. High contrast. No shadows