User prompt
color theme dark green background
User prompt
it shoots very small red squares
User prompt
pink square drags sideways and shoots red cubes
User prompt
make the pink square shoot green rays and when hitting the balls the score changes numbers
User prompt
make neon green balls descend and each time they are hit they disappear
User prompt
put dots at the top right color numbers white with illuminated blue border
User prompt
remove the green squares that come down
User prompt
remove the light green squares
User prompt
make the pink square big and fire light green squares and when hitting other squares make them disappear
Initial prompt
Yronix
===================================================================
--- original.js
+++ change.js
@@ -39,29 +39,9 @@
self.move = function (x, y) {
self.x = x;
self.y = y;
};
- self.shoot = function () {
- var bullet = new HeroBullet();
- bullet.x = self.x;
- bullet.y = self.y - 50; // Shoot from above the hero
- game.addChild(bullet);
- heroBullets.push(bullet);
- };
});
-// HeroBullet class
-var HeroBullet = Container.expand(function () {
- var self = Container.call(this);
- var bulletGraphics = self.attachAsset('heroBullet', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- bulletGraphics.tint = 0x90EE90;
- self.speed = -10;
- self.move = function () {
- self.y += self.speed;
- };
-});
/****
* Initialize Game
****/
@@ -75,9 +55,8 @@
// Global variables
var hero = new Hero();
hero.x = 1024; // Center horizontally
hero.y = 2500; // Near the bottom
-var heroBullets = [];
var enemies = [];
var enemyBullets = [];
// Add hero to the game
game.addChild(hero);
@@ -88,17 +67,8 @@
hero.shoot();
});
// Game tick event
LK.on('tick', function () {
- // Move hero bullets
- for (var i = heroBullets.length - 1; i >= 0; i--) {
- heroBullets[i].move();
- if (heroBullets[i].y < 0) {
- // Bullet off-screen
- heroBullets[i].destroy();
- heroBullets.splice(i, 1);
- }
- }
// Move enemies and enemy bullets
for (var j = enemies.length - 1; j >= 0; j--) {
enemies[j].move();
if (enemies[j].y > 2732) {
@@ -118,20 +88,8 @@
if (hero.intersects(enemyBullets[k])) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
- // Check collision between hero bullets and enemies
- for (var i = heroBullets.length - 1; i >= 0; i--) {
- for (var j = enemies.length - 1; j >= 0; j--) {
- if (heroBullets[i].intersects(enemies[j])) {
- enemies[j].destroy();
- enemies.splice(j, 1);
- heroBullets[i].destroy();
- heroBullets.splice(i, 1);
- break;
- }
- }
- }
}
// Spawn enemies and bullets
if (LK.ticks % 120 == 0) {
// Every 2 seconds