User prompt
the default powerup should still make the ship fly twice as fast
User prompt
Make powerups be triggered for 15 secs
User prompt
Use separate assets for different powerup types
User prompt
Add a new powerup that gives the ship two cannons, one one each side of the spaceship.
User prompt
Make the spaceship fire much slower
User prompt
Decrease the powerup spawn rate by 5x
User prompt
Make sure that wave counter progress by one both when a normal wave spawns and when a boss spawn.
User prompt
The amount of enemies per wave increase to quickly
User prompt
Based on our progress so far, consider what to do next and execute this change.
User prompt
Based on our progress so far, consider what to do next and execute this change.
User prompt
Based on our progress so far, consider what to do next and execute this change.
User prompt
Based on our progress so far, consider what to do next and execute this change.
User prompt
XS.asset return assets with anchor points of 0.0,0.0. Adjust anchor points manually for all assets
User prompt
The star field should be attached to stage instead of game to ensure it takes up the full stage width
User prompt
Reset score when player dies
User prompt
Add score to game
User prompt
The game seems to break now when some bullets hit the hero?
User prompt
Remove bullets that hit the hero
User prompt
Change the circle pattern to figure eights that are slower than the current circles.
User prompt
Enemies and hero should have health points that decrease if hit by bullets and should only die when out of health points.
User prompt
Add reset game function to the game, that resets all game states back to the starting state. Call this method when the hero dies from being hit by enemy bullets.
User prompt
Health bars should be positioned 5px above, and have the same vertical center as the main graphic of the asset they are attached too.
User prompt
Add health bars to the game, then add health bars to the hero and enemies.
User prompt
Make enemy bullets be fired in the direction of the hero
User prompt
make enemies shoot
//Always include this, it helps AI's
//@include('ai-support.js')
XS.stageContainer.setBackgroundColor(0x0);
function game() {
var StarField = Container.expand(function() {
var self = Container.call(this);
self.stars = [];
var numberOfStars = 300;
for (var i = 0; i < numberOfStars; i++) {
var star = XS.getAsset('star', 'Star');
star.x = Math.random() * stage.width;
star.y = Math.random() * stage.height;
star.speed = Math.random() * 2 + 0.5;
star.alpha = Math.random() * 0.5 + 0.5;
self.addChild(star);
self.stars.push(star);
}
self.update = function() {
for (var i = 0; i < self.stars.length; i++) {
var star = self.stars[i];
star.y += star.speed;
if (star.y > stage.height) {
star.y -= stage.height;
}
}
};
});
var Hero = Container.expand(function() {
var self = Container.call(this);
var heroGraphics = XS.getAsset('hero', 'Hero Space Ship');
self.addChild(heroGraphics);
self.fireBullet = function() {
var bullet = new Bullet();
bullet.x = self.x;
bullet.y = self.y - heroGraphics.height / 2;
return bullet;
};
});
var Enemy = Container.expand(function() {
var self = Container.call(this);
var enemyGraphics = XS.getAsset('enemy', 'Enemy Space Ship');
self.addChild(enemyGraphics);
self.state = "flyingIntoScreen";
self.flyInY = Math.random() * (2732 / 2 - 100) + 50;
self.angle = 0;
self.shootCounter = Math.random() * 100;
self.shoot = function() {
var enemyBullet = new EnemyBullet();
enemyBullet.x = self.x;
enemyBullet.y = self.y + enemyGraphics.height / 2;
return enemyBullet;
};
self.move = function(speed) {
if (self.state === "flyingIntoScreen") {
self.y += speed;
if (self.y >= self.flyInY) {
self.state = "circularPattern";
}
} else if (self.state === "circularPattern") {
self.angle += 0.05;
self.x += Math.cos(self.angle) * speed;
self.y += Math.sin(self.angle) * speed;
}
};
});
var EnemyBullet = Container.expand(function() {
var self = Container.call(this);
var bulletGraphics = XS.getAsset('enemyBullet', 'Enemy Bullet');
self.addChild(bulletGraphics);
});
var Bullet = Container.expand(function() {
var self = Container.call(this);
var bulletGraphics = XS.getAsset('bullet', 'Bullet');
self.addChild(bulletGraphics);
});
var SpaceShooter = Container.expand(function() {
var self = Container.call(this);
var starField = self.addChild(new StarField());
var hero = self.addChild(new Hero());
hero.x = 1024;
hero.y = 2420;
var enemies = [];
var bullets = [];
var enemyBullets = [];
var spawnEnemy = function(x, y) {
var enemy = new Enemy();
enemy.x = x;
enemy.y = y;
self.addChild(enemy);
enemies.push(enemy);
};
var fireBullet = function() {
var bullet = hero.fireBullet();
self.addChild(bullet);
bullets.push(bullet);
};
// Add a new function to spawn a wave of enemies
var spawnWave = function() {
for (var i = 0; i < 5; i++) {
var x = Math.random() * (2048 - 100) + 50;
spawnEnemy(x, -100);
}
};
// Call this function to start the first wave
spawnWave();
var autoFire = XS.setInterval(function() {
fireBullet();
}, 200); // Set an interval of 200ms for auto firing bullets
// Add a variable to store the target position for the hero
var targetPosition = {
x: hero.x,
y: hero.y
};
// Store the new target position when the mouse moves
stage.on('move', function(obj) {
var event = obj.event;
var pos = event.getLocalPosition(self);
targetPosition.x = pos.x;
targetPosition.y = pos.y;
});
// Update the hero's position to move towards a fixed speed
var heroSpeed = 15;
XS.on('tick', function() {
var dx = targetPosition.x - hero.x;
var dy = targetPosition.y - hero.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > heroSpeed) {
hero.x += dx * heroSpeed / distance;
hero.y += dy * heroSpeed / distance;
} else {
hero.x = targetPosition.x;
hero.y = targetPosition.y;
}
// Ensure the hero stays within the playable area
hero.x = Math.min(Math.max(hero.x, 0), 2048);
hero.y = Math.min(Math.max(hero.y, 0), 2732);
});
XS.on('tick', function() {
starField.update();
for (var i = 0; i < enemies.length; i++) {
enemies[i].move(5); // Use new move function
}
for (var i = 0; i < enemies.length; i++) {
enemies[i].move(5); // Use new move function
enemies[i].shootCounter--;
if (enemies[i].shootCounter <= 0) {
var enemyBullet = enemies[i].shoot();
self.addChild(enemyBullet);
enemyBullets.push(enemyBullet);
enemies[i].shootCounter = 100 + Math.random() * 100;
}
}
for (var j = 0; j < enemyBullets.length; j++) {
enemyBullets[j].y += 7;
if (enemyBullets[j].y > stage.height + 30) {
self.removeChild(enemyBullets[j]);
enemyBullets.splice(j, 1);
j--;
}
}
for (var j = 0; j < bullets.length; j++) {
bullets[j].y -= 10;
if (bullets[j].y < -30) {
self.removeChild(bullets[j]);
bullets.splice(j, 1);
j--;
} else {
for (var k = enemies.length - 1; k >= 0; k--) {
var enemy = enemies[k];
// Check if bullet is intersecting enemy
if (bullets[j].x >= enemy.x - enemy.width / 2 &&
bullets[j].x <= enemy.x + enemy.width / 2 &&
bullets[j].y >= enemy.y - enemy.height / 2 &&
bullets[j].y <= enemy.y + enemy.height / 2) {
// Remove bullet and enemy and update list
self.removeChild(bullets[j]);
bullets.splice(j, 1);
self.removeChild(enemies[k]);
enemies.splice(k, 1);
j--;
// Check if all enemies are killed and spawn the next wave
if (enemies.length === 0) {
spawnWave();
}
break;
}
}
}
}
});
});
var spaceShooterGame = new SpaceShooter();
stage.addChild(spaceShooterGame);
function positionElements() {
spaceShooterGame.x = (stage.width - 2048) / 2;
}
positionElements();
XS.on('resize', positionElements);
}
Alien enemy, adopted to space, flying down Game Texture. In-Game asset. 2d. Pixelart. White background. Blank background. Low detail. High contrast.
Alien enemy boss, adopted to space, flying down Game Texture. In-Game asset. 2d. Pixelart. White background. Blank background. Low detail. High contrast.
Alien enemy, adopted to space, flying down Game Texture. In-Game asset. 2d. Pixelart. blank background. Low detail. High contrast.
Hero Spaceship, flying up, single cannon in the center Game Texture. In-Game asset. 2d. Pixelart. blank background. Low detail. High contrast.
Dark circular power up with three bright yellow arrows pointing upwards. Game Texture. In-Game asset. 2d. Pixelart. White background. Blank background. Low detail. High contrast.
Dark circular power up indicating double cannons. Game Texture. In-Game asset. 2d. Pixelart. White background. Blank background. Low detail. High contrast.
Create a 2D top-down view pixel art image of a bullet for a space shooter game. The bullet should be facing upward, as it will be used as a projectile fired from the hero spaceship towards enemies in the game. The design should be sleek and give off a sense of motion. Please provide the image on a white background. Game Texture. In-Game asset. 2d. Pixelart. blank background. Low detail. High contrast.
Single alien slime bullet, round. Game Texture. In-Game asset. 2d. Pixelart. blank background. Low detail. High contrast.
Single alien boss slime bullet, round Game Texture. In-Game asset. 2d. Pixelart. White background. Blank background. Low detail. High contrast.