User prompt
Half the wave counter size
User prompt
Move the Wave: text next to the pause button.
User prompt
Move the Wave: text closer to the pause button.
User prompt
Move the Wave: text next to the pause button.
User prompt
Move the Wave: text to the topright corner of the map
User prompt
Place the Wave: text to the left bottom corner of the map
User prompt
Remove block from the game
User prompt
Remove boss enemy from the game
User prompt
Ensure hero is not shoot from the center of the asset but from the left and right edge of the asset
User prompt
Migrate to the latest version of LK
Remix started
Copy Air Force War (UPDATE 3.5)
===================================================================
--- original.js
+++ change.js
@@ -50,48 +50,8 @@
anchorX: 0.5,
anchorY: 0.5
});
});
-// Define the BossEnemy class
-var BossEnemy = Container.expand(function () {
- var self = Container.call(this);
- var bossGraphics = self.attachAsset('bossEnemy', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- // Initialize boss-specific properties
- self.health = 50; // Boss has more health
- self.speed = 2; // Boss moves slower
- self.shootInterval = 21; // Boss shoots every 0.35 seconds at 60FPS
- self.lastShotTick = 0; // Track the last shot tick
- // Initialize direction for structured movement
- self.directionX = Math.random() < 0.5 ? -1 : 1;
- self.directionY = Math.random() < 0.5 ? -1 : 1;
- self._update_migrated = function () {
- // Boss update logic with structured movement
- self.x += self.directionX * self.speed;
- self.y += self.directionY * self.speed;
- // Reverse direction when hitting the screen boundaries
- if (self.x <= 100 || self.x >= 1948) {
- self.directionX *= -1;
- }
- if (self.y <= 100 || self.y >= 2732 / 2 - 100) {
- self.directionY *= -1;
- }
- // Boss specific logic for shooting
- self.shoot();
- };
- self.shoot = function () {
- if (LK.ticks - self.lastShotTick >= self.shootInterval) {
- var bullet = new EnemyBullet();
- bullet.x = self.x;
- bullet.y = self.y + 50; // Adjust bullet start position
- enemyBullets.push(bullet);
- game.addChild(bullet);
- self.lastShotTick = LK.ticks;
- }
- };
-});
// Define the Enemy class
var Enemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('enemy', {
@@ -203,15 +163,9 @@
self.waveCount = 0;
self.enemiesPerWave = 5;
self.enemies = [];
self.createWave = function () {
- if ((self.waveCount + 1) % 5 === 0) {
- // Every 5 waves, spawn a BossEnemy instead of regular enemies
- var bossEnemy = game.addChild(new BossEnemy());
- bossEnemy.x = 2048 / 2; // Start in the middle of the screen
- bossEnemy.y = 2732 / 4; // Start in the upper part of the screen
- self.enemies.push(bossEnemy);
- } else {
+ {
// Other waves: Spawn regular enemies
for (var i = 0; i < self.enemiesPerWave; i++) {
var enemy = game.addChild(new Enemy());
enemy.x = Math.random() * (2048 - 100) + 50;