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
@@ -1,19 +1,7 @@
/****
* Classes
****/
-// Enemy class
-var Enemy = Container.expand(function () {
- var self = Container.call(this);
- var enemyGraphics = self.attachAsset('enemy', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.speed = 2;
- self.move = function () {
- self.y += self.speed;
- };
-});
// EnemyBullet class
var EnemyBullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.attachAsset('enemyBullet', {
@@ -55,10 +43,8 @@
// Global variables
var hero = new Hero();
hero.x = 1024; // Center horizontally
hero.y = 2500; // Near the bottom
-var enemies = [];
-var enemyBullets = [];
// Add hero to the game
game.addChild(hero);
// Touch event to move hero and shoot
game.on('down', function (obj) {
@@ -68,40 +54,6 @@
});
// Game tick event
LK.on('tick', function () {
// Move enemies and enemy bullets
- for (var j = enemies.length - 1; j >= 0; j--) {
- enemies[j].move();
- if (enemies[j].y > 2732) {
- // Enemy off-screen
- enemies[j].destroy();
- enemies.splice(j, 1);
- }
- }
- for (var k = enemyBullets.length - 1; k >= 0; k--) {
- enemyBullets[k].move();
- if (enemyBullets[k].y > 2732) {
- // Bullet off-screen
- enemyBullets[k].destroy();
- enemyBullets.splice(k, 1);
- }
- // Check collision with hero
- if (hero.intersects(enemyBullets[k])) {
- LK.effects.flashScreen(0xff0000, 1000);
- LK.showGameOver();
- }
- }
// Spawn enemies and bullets
- if (LK.ticks % 120 == 0) {
- // Every 2 seconds
- var enemy = new Enemy();
- enemy.x = Math.random() * 2048;
- enemy.y = 0;
- game.addChild(enemy);
- enemies.push(enemy);
- var enemyBullet = new EnemyBullet();
- enemyBullet.x = enemy.x;
- enemyBullet.y = enemy.y + 50;
- game.addChild(enemyBullet);
- enemyBullets.push(enemyBullet);
- }
});
\ No newline at end of file