User prompt
Please fix the bug: 'storage is not defined' in or related to this line: 'storage.bestScore = storage.bestScore || 0;' Line Number: 953 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: LK.getMusic is not a function' in or related to this line: 'var bgMusic = LK.getMusic('BackgroundMusic');' Line Number: 1018
Code edit (4 edits merged)
Please save this source code
User prompt
when the game starts, start the backgroundmusic
Code edit (1 edits merged)
Please save this source code
Code edit (10 edits merged)
Please save this source code
User prompt
on first tap, start backgroundmusic
Code edit (12 edits merged)
Please save this source code
User prompt
in ObstacleExploding._move_migrated please update rotation, so that it's always facing centerx,centery
Code edit (1 edits merged)
Please save this source code
Code edit (12 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: game.add is not a function' in or related to this line: 'game.add(self.parent);' Line Number: 301
Code edit (8 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: trailgraphics is not defined' in or related to this line: 'trailgraphics.tint = 0xff0000;' Line Number: 138
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: particles.destroy is not a function' in or related to this line: 'particles.destroy();' Line Number: 1101
Code edit (3 edits merged)
Please save this source code
User prompt
explosiontrails should explode in a circular pattern
Code edit (2 edits merged)
Please save this source code
User prompt
Instead of just flashing the screen on player death, make the fireball it is explode in a bunch of fading trails like fireworks
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -253,50 +253,49 @@
self.angle = (self.angle || 0) + self.orbitSpeed;
self.angle %= Math.PI * 2;
self.x = self.radius * Math.cos(self.angle);
self.y = self.radius * Math.sin(self.angle);
- /*
- if (self.exploding) {
- if (self.radius > 660) {
- self.radius -= 4;
- } else {
- for (var i = 0; i < 20; i++) {
- var angle = i / 20 * Math.PI * 2;
- var trail = new ExplosionTrail(self.x + Math.cos(angle) * 10, self.y + Math.sin(angle) * 10);
- //trail.setTint("#ff0000");
- self.parent.addChild(trail);
- }
- self.destroy();
- self._destroyed = true;
- }
- }*/
+ self.rotation = Math.atan2(centerY - self.y, centerX - self.x);
if (self.parent == orbits[currentOrbitIndex]) {
//self.exploding = true;
- if (self.radius > 660) {
- self.radius -= 16;
- game.addChild(self.parent);
- game.addChild(playerLayer);
- } else {
- for (var i = 0; i < 20; i++) {
- var angle = i / 20 * Math.PI * 2;
- var trail = new ExplosionTrail(self.x + Math.cos(angle) * 10, self.y + Math.sin(angle) * 10);
- //trail.setTint("#ff0000");
- self.parent.addChild(trail);
- }
- self.destroy();
- self._destroyed = true;
+ self.parent.addFragment(self.angle, self.orbitSpeed);
+ self.parent.addFragment(self.angle, self.orbitSpeed * -1);
+ for (var i = 0; i < 10; i++) {
+ var angle = i / 10 * Math.PI * 2;
+ var trail = new ExplosionTrail(self.x + Math.cos(angle) * 5, self.y + Math.sin(angle) * 5);
+ self.parent.addChild(trail);
}
- /*
- self.scale.x += 0.04;
- self.scale.y += 0.04;
- if (self.scale.x > 3) {
- self.destroy();
- self._destroyed = true;
- }
- */
+ self.destroy();
+ self._destroyed = true;
}
};
});
+var ObstacleFragment = Container.expand(function () {
+ var self = Container.call(this);
+ self.obstacleGraphics = self.attachAsset('obstacleFragment', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.orbitSpeed;
+ self.rotatingRight;
+ self.radius; // = 0;
+ self.initialPosition = function (speed, angle, radius) {
+ self.angle = angle;
+ self.orbitSpeed = speed;
+ self.radius = radius;
+ self.x = self.radius * Math.cos(self.angle);
+ self.y = self.radius * Math.sin(self.angle);
+ if (speed < 0) {
+ self.obstacleGraphics.rotation *= -1;
+ }
+ };
+ self._move_migrated = function () {
+ self.angle = (self.angle || 0) + self.orbitSpeed;
+ self.angle %= Math.PI * 2;
+ self.x = self.radius * Math.cos(self.angle);
+ self.y = self.radius * Math.sin(self.angle);
+ };
+});
var ObstacleSeeker = Container.expand(function () {
var self = Container.call(this);
self.obstacleGraphics = self.attachAsset('obstacleSeeker', {
anchorX: 0.5,
@@ -308,11 +307,8 @@
});
self.obstacleGraphics2.alpha = 0;
self.orbitSpeed = 0; // This is set by the Orbit that instantiates this obstacle, so obstacles in same orbit have same speed.
self.rotatingRight = Math.random() < 0.5 ? true : false;
- /*if (self.parent) {
- self.radius = self.parent.width / 2 * (1900 / self.parent.width) - self.width / 2;
- }*/
self.radius = 0;
self.initialPosition = function (speed, angle, radius) {
self.angle = angle;
self.orbitSpeed = Math.max(0.01, speed);
@@ -332,10 +328,8 @@
}
};
self._move_migrated = function () {
self.determineDirection();
- //self.radius = self.parent.width / 2 * (1900 / self.parent.width) - self.width / 2 * (100 / self.width);
- //self.radius = self.parent.width / 2 * (1900 / self.parent.width) - self.width / 2; // * (100 / self.width);
//only move if player is one the same orbit.
if (self.parent == orbits[currentOrbitIndex]) {
self.obstacleGraphics2.alpha = 1;
self.obstacleGraphics.alpha = 0;
@@ -371,11 +365,8 @@
anchorY: 0.5
});
self.orbitSpeed = 0; // This is set by the Orbit that instantiates this obstacle, so obstacles in same orbit have same speed.
self.rotatingRight = Math.random() < 0.5 ? true : false;
- /*if (self.parent) {
- self.radius = self.parent.width / 2 * (1900 / self.parent.width) - self.width / 2;
- }*/
self.radius = 0;
self.initialPosition = function (speed, angle, radius) {
self.angle = angle;
self.orbitSpeed = speed;
@@ -383,15 +374,12 @@
self.x = self.radius * Math.cos(self.angle);
self.y = self.radius * Math.sin(self.angle);
};
self.lookAtPlayer = function () {
- //var globalTurretPosition = self.toGlobal();
- //var playerAngle = Math.atan2(player.y - globalTurretPosition.y, player.x - globalTurretPosition.x);
var playerAngle = Math.atan2(player.y - (self.y + self.parent.y), player.x - (self.x + self.parent.x));
self.rotation = playerAngle;
};
self.shootAtPlayer = function () {
- //var globalTurretPosition = self.toGlobal();
var playerAngle = Math.atan2(player.y - (self.y + self.parent.y), player.x - (self.x + self.parent.x));
var turretShot = new Container();
var shotGraphics = turretShot.attachAsset('turretShot', {
anchorX: 0.5,
@@ -435,15 +423,13 @@
var self = Container.call(this);
var orbitGraphics = self.attachAsset('orbit1', {
anchorX: 0.5,
anchorY: 0.5,
- //tint: Math.floor(Math.random() * 16777215)
- //tint: rainbowColors[orbitsCreated % rainbowColors.length]
tint: rainbowColors[colorOffset % rainbowColors.length]
});
orbitsCreated++;
colorOffset++;
- orbitGraphics.alpha = 0.5; //0.5;
+ orbitGraphics.alpha = 0.5;
self.direction = Math.random() < 0.5 ? 1 : -1;
self.positionOrbit = function (i) {
// Set position and scale.
self.x = centerX;
@@ -509,50 +495,8 @@
//self.addBarrier(self.barrierSpeed, i);
self.addObstacleExploding(self.barrierSpeed, i);
}
};
- self.OBS_positionOrbit = function (i) {
- self.x = 2048 / 2;
- self.y = 2732 / 2;
- //this.width = 1900 - i * 500;
- self.width = self.height = 1900 - i * 500;
- if (i !== 0) {
- // Spawn normal enemies
- self.numBarriers = Math.ceil(Math.random() * maxEnemiesPerOrbit);
- if (self.numBarriers > maxEnemiesPerOrbit) {
- self.numBarriers = maxEnemiesPerOrbit;
- }
- // Add powerup to some orbits
- if (orbitsCreated % 17 == 0) {
- self.numBarriers = 0;
- self.addPowerup();
- }
- // We might want some static orbits. And max speed should be limited by total progression.
- if (Math.random() <= 0.2) {
- self.barrierSpeed = 0;
- } else {
- // The global var maxEnemySpeed is incremented every 10 obits or so.
- self.barrierSpeed = maxEnemySpeed * Math.random() * self.direction;
- }
- //self.barrierSpeed = 0.01 + Math.random() * 0.015 * self.direction;
- if (Math.random() < 0.9) {
- for (var j = 0; j < this.numBarriers; j++) {
- self.addBarrier(self.barrierSpeed, j);
- //console.log('adding barrier: ', j);
- }
- } else {
- if (Math.random() < 0.5) {
- for (var j = 0; j < 2; j++) {
- self.addSeekerObstacle(self.barrierSpeed, j);
- }
- } else {
- //self.addDragon();
- self.addObstacleTurret();
- }
- }
- self.addCollectible();
- }
- };
/*
var orbitGraphicsMask = self.attachAsset('blackSphere', {
anchorX: 0.5,
anchorY: 0.5,
@@ -578,8 +522,15 @@
barrier.initialPosition(speed, angle, radius);
self.addChild(barrier);
obstacles.push(barrier);
};
+ self.addFragment = function (angle, speed) {
+ var fragment = new ObstacleFragment();
+ var radius = 880;
+ fragment.initialPosition(speed, angle, radius);
+ self.addChild(fragment);
+ obstacles.push(fragment);
+ };
self.addSeekerObstacle = function (speed, index) {
var seeker = new ObstacleSeeker();
var angle = Math.random() * (Math.PI * 2);
var radius = 880;
@@ -589,11 +540,9 @@
};
self.addDragon = function () {
for (var i = 0; i < 10; i++) {
var dragon = new Dragon(i == 0, i);
- //dragon.angle = Math.PI * 1.5 - i * 0.03;
var angle = Math.PI * 1.5 - i * 0.03;
- //dragon.angle = Math.PI * 1.5 - i * 0.02;
dragon.scale.x = 1 - (i + 1) * 0.075; //0.15
dragon.scale.y = 1 - (i + 1) * 0.075;
dragon.initialPosition(angle);
self.addChild(dragon);
@@ -608,13 +557,11 @@
turret.initialPosition(speed, angle, radius);
self.addChild(turret);
obstacles.push(turret);
};
- //self.addPowerup = function (index) {
self.addPowerup = function () {
for (var i = 0; i < 5; i++) {
var powerup = new Powerup1();
- //powerup.angle = Math.PI * 1.5 - i * 0.08;
var angle = Math.PI * 1.5 - i * 0.08;
var radius = 880;
powerup.scale.x = 1 - (i + 1) * 0.15;
powerup.scale.y = 1 - (i + 1) * 0.15;
@@ -626,14 +573,10 @@
self.addCollectible = function (num) {
var angleOffset = Math.random() * (Math.PI * 2);
for (var i = 0; i < num; i++) {
var collectible = new Collectible();
- // TODO: Maybe orbitspeed should always be 0 (or close to 0) for these collectibles, But they should pulse in place instead.
- //collectible.orbitSpeed = 0.01 + Math.random() * 0.015 * self.direction;
collectible.orbitSpeed = 0.0005 * self.direction;
- //collectible.angle = 0.00001 + i * (Math.PI * 2 / num); //Math.random() * (Math.PI * 2);
var angle = 0.00001 + i * (Math.PI * 2 / num) + angleOffset;
- //collectible.radius = 880;
collectible.initialPosition(880, angle);
self.addChild(collectible);
obstacles.push(collectible);
}
@@ -1169,8 +1112,9 @@
GAME_ENDED = true;
LK.setTimeout(function () {
LK.showGameOver();
}, 6000);
+ break;
}
}
} else {
obstacles.splice(i, 1);
Make the circle completely black on all pixels.
A white star. Flat vector art.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
The line-color should be white, and the circle a bit thinner.
a wonderful but not very dense starfield. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A glowing blue comic energy orb. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
I'd like a top down image of a super fine and thin white empty cicular band on a transparent background. It should be flatly white and with no other details, and of course perfectly round with blank space in the center. The band's width should be less than one percent of the width of the circle itself, as if a 1 cm band were laid out in a circle with a diameter of 100 cm. Single Game Texture. In-Game asset. 2d. Blank background.