User prompt
Not too much
User prompt
Why the coins not spawning
User prompt
Fix Bug: 'ReferenceError: Enemy is not defined' in this line: 'var newEnemy = new Enemy();' Line Number: 182
User prompt
Replace the spawning normal enemy with enemy
User prompt
Reset back all enemy types
User prompt
Fix Bug: 'TypeError: enemyType is not a constructor' in this line: 'var newEnemy = new enemyType();' Line Number: 192
User prompt
Fix Bug: 'ReferenceError: NormalEnemy is not defined' in this line: 'var enemyType = Math.random() > 0.5 ? NormalEnemy : FastEnemy;' Line Number: 182
User prompt
Fix Bug: 'ReferenceError: NormalEnemy is not defined' in this line: 'var enemyType = Math.random() > 0.5 ? NormalEnemy : FastEnemy;' Line Number: 182
User prompt
Change back to normal enemy
User prompt
Fix Bug: 'ReferenceError: NormalEnemy is not defined' in this line: 'var enemyType = Math.random() > 0.5 ? FastEnemy : NormalEnemy;' Line Number: 182
User prompt
Make both types of enemy spawn
User prompt
Fix Bug: 'ReferenceError: Enemy is not defined' in this line: 'var newEnemy = new Enemy();' Line Number: 182
User prompt
Make another type of enemy that has faster movement than normal one
User prompt
Change coin earning upgrade to coin spawn average instead
User prompt
Make coin upgrade button increases the coin you obtain everytime u click coin
User prompt
Make frenzy button also increase coin spawn rate
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'width')' in this line: 'upgradesTxt.x = LK.gui.left.x + fireRateUpgradeButton.width / 2 + 100;' Line Number: 218
User prompt
Add text that says 'Upgrades' above the 2 upgrade button
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'width')' in this line: 'coinEarningUpgradeButton.x = LK.gui.left.x + fireRateUpgradeButton.width + 200;' Line Number: 214
User prompt
Make coins earning upgrade button that increases coins earning when clicking a coin by 1 for 10 coins
User prompt
More right pls
User prompt
Move frenzy button to right
User prompt
Put frenzy button in same height of fire rate button
User prompt
Put frenzy button to right screen part
User prompt
Put fire rate upgrade button to left screen part
/**** * Classes ****/ // Hero class var Hero = Container.expand(function () { var self = Container.call(this); var heroGraphics = self.createAsset('hero', 'Hero character', 0.5, 0.5); self.fireRateLevel = 0; // Initialize hero's fire rate level self.shoot = function () { // Shooting logic will be implemented in the game logic section }; self.update = function () { // Update logic for the hero, if needed }; }); // Bullet class var Bullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.createAsset('bullet', 'Hero Bullet', 0.5, 0.5); self.speed = -10; self.move = function () { self.y += self.speed; }; }); // Enemy class var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.createAsset('enemy', 'Enemy character', 0.5, 0.5); self.speed = 2; self.move = function () { self.y += self.speed; }; }); // FrenzyButton class var FrenzyButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.createAsset('frenzyButton', 'Frenzy Mode Button', 0.5, 0.5); self.cooldown = false; self.activateFrenzy = function () { if (!self.cooldown) { game.frenzyMode = true; LK.setTimeout(function () { game.frenzyMode = false; }, 5000); // Frenzy mode lasts for 5 seconds self.cooldown = true; LK.setTimeout(function () { self.cooldown = false; }, 30000); // 30 second cooldown } }; self.on('down', function () { self.activateFrenzy(); }); }); // Coin class var Coin = Container.expand(function () { var self = Container.call(this); var coinGraphics = self.createAsset('coin', 'Game Coin', 0.5, 0.5); self.value = 1; // Default value, can be increased by shop upgrades self.collect = function () { game.coins += self.value; coinTxt.setText(game.coins.toString()); // Update the coin display text self.destroy(); }; self.on('down', function () { self.collect(); }); }); // FireRateUpgradeButton class var FireRateUpgradeButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.createAsset('fireRateUpgradeButton', 'Fire Rate Upgrade Button', 0.5, 0.5); self.on('down', function () { if (game.coins >= 5) { game.coins -= 5; hero.fireRateLevel += 1; coinTxt.setText(game.coins.toString()); } }); }); /**** * Initialize Game ****/ // Create fire rate upgrade button instance // Create frenzy button instance // Create frenzy button instance var game = new LK.Game({ backgroundColor: 0xFFFFFF, // Init game with white background frenzyMode: false // Track frenzy mode status }); /**** * Game Code ****/ game.coins = 0; // Initialize coins as a number before creating coinTxt // Initialize important asset arrays and score var bullets = []; var enemies = []; var score = 0; // Create score display var scoreTxt = new Text2(score.toString(), { size: 150, fill: "#000000" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Create coin display var coinTxt = new Text2(game.coins.toString(), { size: 100, fill: "#ffd700" }); coinTxt.anchor.set(0.5, 0); coinTxt.y = scoreTxt.height + 20; // Position below the score display LK.gui.top.addChild(coinTxt); // Create hero instance var hero = game.addChild(new Hero()); hero.x = 2048 / 2; hero.y = 2732 - 100; // Position hero near the bottom of the screen // Game tick event LK.on('tick', function () { // Move bullets for (var i = bullets.length - 1; i >= 0; i--) { bullets[i].move(); if (bullets[i].y < 0) { bullets[i].destroy(); bullets.splice(i, 1); } } // Move enemies for (var j = enemies.length - 1; j >= 0; j--) { enemies[j].move(); if (enemies[j].y > 2732) { LK.showGameOver(); } } // Check for bullet-enemy collisions for (var b = bullets.length - 1; b >= 0; b--) { for (var e = enemies.length - 1; e >= 0; e--) { if (bullets[b].intersects(enemies[e])) { // Increase score and update display score++; scoreTxt.setText(score.toString()); bullets[b].destroy(); bullets.splice(b, 1); enemies[e].destroy(); enemies.splice(e, 1); break; } } } // Spawn coins if (LK.ticks % 300 == 0) { // Spawn a coin every 5 seconds var newCoin = new Coin(); newCoin.x = Math.random() * 2048; newCoin.y = Math.random() * (2732 - 100); game.addChild(newCoin); } // Spawn enemies var enemySpawnRate = game.frenzyMode ? 60 : 120; // Increased spawn rate during frenzy if (LK.ticks % enemySpawnRate == 0) { var newEnemy = new Enemy(); newEnemy.x = Math.random() * 2048; newEnemy.y = -50; enemies.push(newEnemy); game.addChild(newEnemy); } // Hero shooting var bulletSpawnRate = game.frenzyMode ? 15 : 30 - hero.fireRateLevel * 5; // Increased spawn rate during frenzy and further increased by hero's fire rate level if (LK.ticks % bulletSpawnRate == 0) { var newBullet = new Bullet(); newBullet.x = hero.x; newBullet.y = hero.y; bullets.push(newBullet); game.addChild(newBullet); } // Update hero hero.update(); }); // Touch event to move hero game.on('down', function (obj) { var pos = obj.event.getLocalPosition(game); hero.x = pos.x; }); // Ensure the game is touchscreen compatible game.on('move', function (obj) { if (obj.event.touches && obj.event.touches.length > 0) { var touch = obj.event.touches[0]; var pos = touch.getLocalPosition(game); hero.x = pos.x; } }); // Create frenzy button instance var frenzyButton = game.addChild(new FrenzyButton()); frenzyButton.x = LK.gui.right.x - frenzyButton.width / 2; frenzyButton.y = LK.gui.center.y; // Create fire rate upgrade button instance var fireRateUpgradeButton = game.addChild(new FireRateUpgradeButton()); fireRateUpgradeButton.x = LK.gui.left.x + 100; fireRateUpgradeButton.y = LK.gui.bottom.y - 100;
===================================================================
--- original.js
+++ change.js
@@ -194,10 +194,10 @@
}
});
// Create frenzy button instance
var frenzyButton = game.addChild(new FrenzyButton());
-frenzyButton.x = LK.gui.right.x - 100;
-frenzyButton.y = LK.gui.bottom.y - 200;
+frenzyButton.x = LK.gui.right.x - frenzyButton.width / 2;
+frenzyButton.y = LK.gui.center.y;
// Create fire rate upgrade button instance
var fireRateUpgradeButton = game.addChild(new FireRateUpgradeButton());
fireRateUpgradeButton.x = LK.gui.left.x + 100;
fireRateUpgradeButton.y = LK.gui.bottom.y - 100;
\ No newline at end of file
Coin. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Fighter jet. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Has rocket behind to boost movement to down faster
Explosion. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Medkit. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.