Code edit (2 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
make textline15 below textline14 and make it say: This game is no longer updated.
Code edit (1 edits merged)
Please save this source code
User prompt
remove highscoretxt
User prompt
Fix Bug: 'ReferenceError: highScoreTxt is not defined' in or related to this line: 'highScoreTxt.setText('High Score: ' + highScore + ' (WIP)');' Line Number: 702
User prompt
Fix Bug: 'Uncaught ReferenceError: ScoreTxt is not defined' in or related to this line: 'cosmicCreditsTxt.y = ScoreTxt.y + ScoreTxt.height + 20; // Position below the high score display' Line Number: 578
Code edit (3 edits merged)
Please save this source code
User prompt
Fix Bug: 'Uncaught ReferenceError: highScoreTxt is not defined' in or related to this line: 'highScoreTxt.anchor.set(1, 0);' Line Number: 577
Code edit (1 edits merged)
Please save this source code
User prompt
change versiontxt to: v0.2.2 BETA
User prompt
change "Tap anywhere to shoot" to: "Double tap anywhere to shoot"
User prompt
make it so the user has to double tap to shoot bullet
User prompt
change versiontxt to be v0.21 BETA
User prompt
the bulletpack bounce off the walls then move the other way. Make it more unpredictable and that they don't have to hit the walls to move the other way
User prompt
the enemies bounce off the walls then move the other way. Make it more unpredictable and that they don't have to hit the walls to move the other way
User prompt
make bullet pack rarity 1/5 of enemy rarity
User prompt
the bulletpack asset does not show up when it is meant to
User prompt
why are there no bulletpacks appearing?
User prompt
the bulletpack bounces off the walls then move the other way. Make it more unpredictable and that they don't have to hit the walls to move the other way
User prompt
the enemies bounce off the walls then move the other way. Make it more unpredictable and that they don't have to hit the walls to move the other way
User prompt
save this
===================================================================
--- original.js
+++ change.js
@@ -36,15 +36,19 @@
var BulletPack = Container.expand(function () {
var self = Container.call(this);
var bulletPackGraphics = self.attachAsset('bulletPack', {
anchorX: 0.5,
- anchorY: 0.5,
- id: '65ac25b445869b8be6c9cd03'
+ anchorY: 0.5
});
self.speed = 4;
+ self.direction = Math.random() < 0.5 ? -1 : 1;
self.move = function () {
var speedIncreaseFactor = 0.1 + LK.ticks * 0.0002;
self.y += self.speed + speedIncreaseFactor;
+ self.x += self.direction * (10 + speedIncreaseFactor);
+ if (self.x < 0 || self.x > game.width) {
+ self.direction *= -1;
+ }
};
});
// Character class
var Hero = Container.expand(function () {
@@ -98,11 +102,19 @@
self.move = function () {
self.y += self.speed;
var speedIncreaseFactor = 0.1 + LK.ticks * 0.0002; // Increase the speed factor over time
self.x += self.direction * (4 + speedIncreaseFactor);
- if (self.x < 0 || self.x > game.width) {
+ // Randomly change direction with a 5% chance each tick
+ if (Math.random() < 0.05 || self.x < 0 || self.x > game.width) {
self.direction *= -1;
}
+ // Keep enemy within game bounds
+ if (self.x < 0) {
+ self.x = 0;
+ }
+ if (self.x > game.width) {
+ self.x = game.width;
+ }
self.speed += 0.02 + LK.ticks * 0.0001; // Increase speed over time with an accelerating factor
};
});
var Button = Container.expand(function (text, positionX, positionY, onClickCallback) {
@@ -232,9 +244,8 @@
});
// Initialize important asset arrays
var heroBullets = [];
var enemies = [];
-var bulletPacks = [];
// Create character
var hero = game.addChild(new Hero());
hero.x = game.width / 2;
hero.y = game.height - 100;
@@ -373,9 +384,9 @@
enemies.splice(k, 1);
}
}
var enemySpawnRate = 60; // Initialize enemy spawn rate
- // Spawn enemies
+ // Spawn enemies and bullet packs
if (LK.ticks % enemySpawnRate == 0) {
var enemy = new Enemy();
enemy.x = Math.random() * (game.width - enemy.width) + enemy.width / 2;
enemy.y = -enemy.height;
@@ -384,13 +395,13 @@
if (enemySpawnRate > 30) {
enemySpawnRate -= 0.5;
} // Decrease spawn rate over time to a minimum of 30 ticks
}
- // Spawn bullet packs
- if (LK.ticks % (enemySpawnRate * 5) == 0) {
+ if (LK.ticks % 600 == 0) {
+ // Spawn a bullet pack every 600 ticks
var bulletPack = new BulletPack();
bulletPack.x = Math.random() * (game.width - bulletPack.width) + bulletPack.width / 2;
bulletPack.y = -bulletPack.height;
- bulletPacks.push(bulletPack);
+ enemies.push(bulletPack); // Add bullet pack to enemies array for collision detection
game.addChild(bulletPack);
}
});
\ No newline at end of file
android. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
letter X png. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
space background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
galaxy background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
galaxy background. High quality
space background.. High contrast