User prompt
Fix Bug: 'ReferenceError: Can't find variable: HeroBullet' in this line: 'var bullet = new HeroBullet();' Line Number: 19
User prompt
Power ups make you shoot in a spread
User prompt
Make enimies drop power ups that make you stronger for 1 minute e.g spread shot, laser, bomb
User prompt
Remove the boss system
User prompt
Give all enemies health bars that increase by one every 3 waves
User prompt
Create a separate asset for the boss
User prompt
Add a skip to wave 5 button above the debug menu
User prompt
Move the debug menu up higher
User prompt
Add a debug menu above the joystick
User prompt
Add a bossfight on wave five that shoots a spread of projectiles
User prompt
Fix Bug: 'ReferenceError: Can't find variable: waveTxt' in this line: 'waveTxt.setText('Wave: ' + currentWave);' Line Number: 250
User prompt
Add a wave display
User prompt
Show the wave in the top left
User prompt
Make a boss spawn every 5 waves instead of at 50 score
User prompt
Add a wave system
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'self.lives = 3')' in this line: 'self.lives = 3;' Line Number: 65
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'self.lives = 3')' in this line: 'self.lives = 3;' Line Number: 65
User prompt
Make a boss that fires in a spread and has 3 lives, but only comes out every time you get 50 points
User prompt
Give the player 5 lives
User prompt
Make the enemies get stronger for every 50 points you get
User prompt
Change the games background to look like mars
User prompt
Make the background look like Earth
User prompt
Add a shoot button on the right of the screen
User prompt
Joystick for movement
Initial prompt
Hyper Shootout
/**** * 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.speed = 5; self.bulletCooldown = 0; self.lives = 5; // Player starts with 5 lives self.moveLeft = function () { self.x = Math.max(self.width / 2, self.x - self.speed); }; self.moveRight = function () { self.x = Math.min(2048 - self.width / 2, self.x + self.speed); }; self.shoot = function () { if (self.bulletCooldown <= 0) { var bullet = new HeroBullet(); bullet.x = self.x; bullet.y = self.y - self.height / 2; game.addChild(bullet); bullets.push(bullet); self.bulletCooldown = 20; // Cooldown period before next shot } }; self.powerUpTimer = 0; self.powerUpActive = false; self.enableSpreadShot = function () { self.powerUpActive = true; self.powerUpTimer = 3600; // 1 minute at 60FPS // Additional logic for spread shot effect }; self.enableLaser = function () { self.powerUpActive = true; self.powerUpTimer = 3600; // 1 minute at 60FPS // Additional logic for laser effect }; self.enableBomb = function () { self.powerUpActive = true; self.powerUpTimer = 3600; // 1 minute at 60FPS // Additional logic for bomb effect }; self.updatePowerUpTimer = function () { if (self.powerUpTimer > 0) { self.powerUpTimer--; if (self.powerUpTimer == 0) { self.powerUpActive = false; // Reset hero's shooting ability to normal } } }; self.update = function () { if (self.bulletCooldown > 0) { self.bulletCooldown--; } var joystickDirection = joystick.getDirection(); if (joystickDirection.x < -10) { self.moveLeft(); } else if (joystickDirection.x > 10) { self.moveRight(); } }; }); // HeroBullet class var HeroBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.createAsset('heroBullet', 'Hero bullet', 0.5, 1); 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.baseSpeed = 2; self.strength = 1; self.updateSpeed = function (score) { self.strength = 1 + Math.floor(score / 50); self.speed = self.baseSpeed * self.strength; }; self.move = function () { self.y += self.speed; }; }); // EnemyBullet class var EnemyBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.createAsset('enemyBullet', 'Enemy bullet', 0.5, 0); self.speed = 5; self.move = function () { self.y += self.speed; }; }); // PowerUp class var PowerUp = Container.expand(function () { var self = Container.call(this); var powerUpGraphics = self.createAsset('powerUp', 'Power up', 0.5, 0.5); self.type = 'spread'; // Default power-up type self.speed = 2; self.move = function () { self.y += self.speed; }; self.applyEffect = function (hero) { // Apply the effect based on power-up type switch (self.type) { case 'spread': hero.enableSpreadShot(); break; case 'laser': hero.enableLaser(); break; case 'bomb': hero.enableBomb(); break; } }; }); // DebugMenu class var DebugMenu = Container.expand(function () { var self = Container.call(this); var menuGraphics = self.createAsset('debugMenu', 'Debug menu', 0.5, 0.5); self.addChild(menuGraphics); // Add buttons and functionality for the debug menu here // Example button to add lives var addLivesButton = self.createAsset('addLivesButton', 'Add Lives', 0.5, 0.5); addLivesButton.on('down', function () { hero.lives += 1; livesTxt.setText('Lives: ' + hero.lives); }); self.addChild(addLivesButton); }); // Joystick class var Joystick = Container.expand(function () { var self = Container.call(this); var joystickGraphics = self.createAsset('joystickBase', 'Joystick base', 0.5, 0.5); var joystickKnob = self.createAsset('joystickKnob', 'Joystick knob', 0.5, 0.5); self.addChild(joystickKnob); self.isDragging = false; self.startPos = { x: 0, y: 0 }; self.currentPos = { x: 0, y: 0 }; self.delta = { x: 0, y: 0 }; self.on('down', function (obj) { self.isDragging = true; self.startPos = obj.event.getLocalPosition(self); }); self.on('move', function (obj) { if (self.isDragging) { self.currentPos = obj.event.getLocalPosition(self); self.delta.x = self.currentPos.x - self.startPos.x; self.delta.y = self.currentPos.y - self.startPos.y; joystickKnob.x = Math.max(-50, Math.min(50, self.delta.x)); joystickKnob.y = Math.max(-50, Math.min(50, self.delta.y)); } }); self.on('up', function (obj) { self.isDragging = false; joystickKnob.x = 0; joystickKnob.y = 0; self.delta.x = 0; self.delta.y = 0; }); self.getDirection = function () { return self.delta; }; }); // ShootButton class var ShootButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.createAsset('shootButton', 'Shoot button', 0.5, 0.5); self.on('down', function () { hero.shoot(); }); }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000, // Init game with black background backgroundImage: 'marsBackground' // Set background image to Mars }); /**** * Game Code ****/ var shootButton = game.addChild(new ShootButton()); shootButton.x = 2048 - 150; // Position from right shootButton.y = 2732 - 150; // Position from bottom var skipToWave5Button = game.addChild(new Text2('Skip to Wave 5', { size: 100, fill: '#ffffff' })); skipToWave5Button.anchor.set(0.5, 0); skipToWave5Button.x = 150; // Position from left skipToWave5Button.y = 2732 - 650; // Position above the debug menu skipToWave5Button.on('down', function () { score = (Math.floor((5 - 1) * 600 / 60) - 1) * 10; // Set score to just before wave 5 scoreTxt.setText(score.toString()); scoreAndWaveTxt.setText('Score: ' + score + ' | Wave: 5'); }); var debugMenu = game.addChild(new DebugMenu()); debugMenu.x = 150; // Position from left debugMenu.y = 2732 - 500; // Position higher above the joystick var joystick = game.addChild(new Joystick()); joystick.x = 150; // Position from left joystick.y = 2732 - 150; // Position from bottom // Initialize important asset arrays var bullets = []; var enemies = []; var enemyBullets = []; var powerUps = []; // Store active power-ups var score = 0; var hero = game.addChild(new Hero()); hero.x = 1024; // Center of the screen hero.y = 2732 - 200; // Near the bottom of the screen // Score display var scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); // Lives display var livesTxt = new Text2('Lives: 5', { size: 100, fill: "#ffffff" }); livesTxt.anchor.set(0, 0); LK.gui.topLeft.addChild(livesTxt); // Score and Wave display var scoreAndWaveTxt = new Text2('Score: 0 | Wave: 1', { size: 100, fill: "#ffffff" }); scoreAndWaveTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreAndWaveTxt); // Game tick event LK.on('tick', function () { // Update hero hero.update(); // Move and check bullets for (var i = bullets.length - 1; i >= 0; i--) { bullets[i].move(); if (bullets[i].y < -bullets[i].height) { bullets[i].destroy(); bullets.splice(i, 1); } else { // Check for bullet collision with enemies for (var j = enemies.length - 1; j >= 0; j--) { if (bullets[i].intersects(enemies[j])) { if (Math.random() < 0.2) { // 20% chance to drop a power-up var powerUpTypes = ['spread', 'laser', 'bomb']; var powerUp = new PowerUp(); powerUp.type = powerUpTypes[Math.floor(Math.random() * powerUpTypes.length)]; powerUp.x = enemies[j].x; powerUp.y = enemies[j].y; game.addChild(powerUp); powerUps.push(powerUp); } enemies[j].destroy(); enemies.splice(j, 1); bullets[i].destroy(); bullets.splice(i, 1); score += 10; scoreTxt.setText(score.toString()); break; } } } } // Move and check enemy bullets for (var k = enemyBullets.length - 1; k >= 0; k--) { enemyBullets[k].move(); if (enemyBullets[k].y > 2732 + enemyBullets[k].height) { enemyBullets[k].destroy(); enemyBullets.splice(k, 1); } else if (enemyBullets[k].intersects(hero)) { hero.lives--; if (hero.lives <= 0) { // Game over condition LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } else { // Flash hero red to indicate hit and update lives display LK.effects.flashObject(hero, 0xff0000, 500); livesTxt.setText('Lives: ' + hero.lives); } enemyBullets[k].destroy(); enemyBullets.splice(k, 1); } } // Move and check power-ups for (var m = powerUps.length - 1; m >= 0; m--) { powerUps[m].move(); if (powerUps[m].y > 2732 + powerUps[m].height) { powerUps[m].destroy(); powerUps.splice(m, 1); } else if (powerUps[m].intersects(hero)) { powerUps[m].applyEffect(hero); powerUps[m].destroy(); powerUps.splice(m, 1); } } // Update hero's power-up timer hero.updatePowerUpTimer(); // Move enemies and potentially shoot for (var l = enemies.length - 1; l >= 0; l--) { enemies[l].move(); if (Math.random() < 0.01) { // Random chance to shoot var enemyBullet = new EnemyBullet(); enemyBullet.x = enemies[l].x; enemyBullet.y = enemies[l].y + enemies[l].height / 2; game.addChild(enemyBullet); enemyBullets.push(enemyBullet); } } // Wave system var waveInterval = 600; // 10 seconds per wave var enemiesPerWave = 5 + Math.floor(score / 100); // Increase number of enemies per wave based on score var currentWave = Math.floor(LK.ticks / waveInterval) + 1; scoreAndWaveTxt.setText('Score: ' + score + ' | Wave: ' + currentWave); if (LK.ticks % waveInterval == 0) { for (var i = 0; i < enemiesPerWave; i++) { var newEnemy = new Enemy(); newEnemy.updateSpeed(score); newEnemy.x = Math.random() * (2048 - newEnemy.width) + newEnemy.width / 2; newEnemy.y = -newEnemy.height / 2 - i * newEnemy.height; enemies.push(newEnemy); game.addChild(newEnemy); } } });
===================================================================
--- original.js
+++ change.js
@@ -23,8 +23,34 @@
bullets.push(bullet);
self.bulletCooldown = 20; // Cooldown period before next shot
}
};
+ self.powerUpTimer = 0;
+ self.powerUpActive = false;
+ self.enableSpreadShot = function () {
+ self.powerUpActive = true;
+ self.powerUpTimer = 3600; // 1 minute at 60FPS
+ // Additional logic for spread shot effect
+ };
+ self.enableLaser = function () {
+ self.powerUpActive = true;
+ self.powerUpTimer = 3600; // 1 minute at 60FPS
+ // Additional logic for laser effect
+ };
+ self.enableBomb = function () {
+ self.powerUpActive = true;
+ self.powerUpTimer = 3600; // 1 minute at 60FPS
+ // Additional logic for bomb effect
+ };
+ self.updatePowerUpTimer = function () {
+ if (self.powerUpTimer > 0) {
+ self.powerUpTimer--;
+ if (self.powerUpTimer == 0) {
+ self.powerUpActive = false;
+ // Reset hero's shooting ability to normal
+ }
+ }
+ };
self.update = function () {
if (self.bulletCooldown > 0) {
self.bulletCooldown--;
}
@@ -67,8 +93,32 @@
self.move = function () {
self.y += self.speed;
};
});
+// PowerUp class
+var PowerUp = Container.expand(function () {
+ var self = Container.call(this);
+ var powerUpGraphics = self.createAsset('powerUp', 'Power up', 0.5, 0.5);
+ self.type = 'spread'; // Default power-up type
+ self.speed = 2;
+ self.move = function () {
+ self.y += self.speed;
+ };
+ self.applyEffect = function (hero) {
+ // Apply the effect based on power-up type
+ switch (self.type) {
+ case 'spread':
+ hero.enableSpreadShot();
+ break;
+ case 'laser':
+ hero.enableLaser();
+ break;
+ case 'bomb':
+ hero.enableBomb();
+ break;
+ }
+ };
+});
// DebugMenu class
var DebugMenu = Container.expand(function () {
var self = Container.call(this);
var menuGraphics = self.createAsset('debugMenu', 'Debug menu', 0.5, 0.5);
@@ -170,8 +220,9 @@
// Initialize important asset arrays
var bullets = [];
var enemies = [];
var enemyBullets = [];
+var powerUps = []; // Store active power-ups
var score = 0;
var hero = game.addChild(new Hero());
hero.x = 1024; // Center of the screen
hero.y = 2732 - 200; // Near the bottom of the screen
@@ -207,8 +258,18 @@
} else {
// Check for bullet collision with enemies
for (var j = enemies.length - 1; j >= 0; j--) {
if (bullets[i].intersects(enemies[j])) {
+ if (Math.random() < 0.2) {
+ // 20% chance to drop a power-up
+ var powerUpTypes = ['spread', 'laser', 'bomb'];
+ var powerUp = new PowerUp();
+ powerUp.type = powerUpTypes[Math.floor(Math.random() * powerUpTypes.length)];
+ powerUp.x = enemies[j].x;
+ powerUp.y = enemies[j].y;
+ game.addChild(powerUp);
+ powerUps.push(powerUp);
+ }
enemies[j].destroy();
enemies.splice(j, 1);
bullets[i].destroy();
bullets.splice(i, 1);
@@ -239,8 +300,22 @@
enemyBullets[k].destroy();
enemyBullets.splice(k, 1);
}
}
+ // Move and check power-ups
+ for (var m = powerUps.length - 1; m >= 0; m--) {
+ powerUps[m].move();
+ if (powerUps[m].y > 2732 + powerUps[m].height) {
+ powerUps[m].destroy();
+ powerUps.splice(m, 1);
+ } else if (powerUps[m].intersects(hero)) {
+ powerUps[m].applyEffect(hero);
+ powerUps[m].destroy();
+ powerUps.splice(m, 1);
+ }
+ }
+ // Update hero's power-up timer
+ hero.updatePowerUpTimer();
// Move enemies and potentially shoot
for (var l = enemies.length - 1; l >= 0; l--) {
enemies[l].move();
if (Math.random() < 0.01) {
A laser. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A laser bullet. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A plus sign. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A mechanical wasp. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A turret. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.