Code edit (7 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'update')' in or related to this line: 'particles[i].update();' Line Number: 626
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (11 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: collectible is not a constructor' in or related to this line: 'var collectible = new collectible();' Line Number: 130
Code edit (1 edits merged)
Please save this source code
Code edit (13 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: scoreText is not defined' in or related to this line: 'scoreText.x -= 20;' Line Number: 384
Code edit (1 edits merged)
Please save this source code
Code edit (5 edits merged)
Please save this source code
User prompt
make a fullscreen background asset and attach it before anything else
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (17 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: particles is not defined' in or related to this line: 'particles.push(particle);' Line Number: 386
Code edit (1 edits merged)
Please save this source code
User prompt
with each jump, set the background color of the game to a new color from the rainbowcolors,
Code edit (1 edits merged)
Please save this source code
User prompt
Migrate to the latest version of LK
Remix started
Copy Orbit Jump
===================================================================
--- original.js
+++ change.js
@@ -6,9 +6,10 @@
var particleGraphics = self.attachAsset('energyPill', {
anchorX: 0.5,
anchorY: 0.5
});
- self.orbitSpeed = 0;
+ self.orbitSpeed = 0; // set by the orbit that spawns it.
+ self.growing = Math.random() <= 0.5 ? true : false;
self._move_migrated = function () {
// Obstacle move logic
//var angleSpeed = -0.01 * self.parent.direction; //self.orbitSpeed;
//self.radius = self.parent.width / 2 - self.width / 2;
@@ -16,8 +17,24 @@
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);
+ // Pulse effect
+ if (self.growing) {
+ if (self.scale.x < 1.1) {
+ self.scale.x += 0.025;
+ self.scale.y += 0.025;
+ } else {
+ self.growing = false;
+ }
+ } else {
+ if (self.scale.x > 0.9) {
+ self.scale.x -= 0.025;
+ self.scale.y -= 0.025;
+ } else {
+ self.growing = true;
+ }
+ }
};
});
// Obstacle class
var Obstacle = Container.expand(function () {
@@ -26,15 +43,29 @@
anchorX: 0.5,
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;
self._move_migrated = function () {
//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);
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.rotatingRight) {
+ if (self.rotation < 0.15) {
+ self.rotation += 0.05;
+ } else {
+ self.rotatingRight = false;
+ }
+ } else {
+ if (self.rotation > -0.15) {
+ self.rotation -= 0.05;
+ } else {
+ self.rotatingRight = true;
+ }
+ }
};
});
// Orbit class
var Orbit = Container.expand(function () {
@@ -52,22 +83,32 @@
self.positionOrbit = function (i) {
self.x = 2048 / 2;
self.y = 2732 / 2;
//this.width = 1900 - i * 500;
- self.width = 1900 - i * 500;
- self.height = self.width;
+ self.width = self.height = 1900 - i * 500;
+ //self.height = self.width;
if (i !== 0) {
- self.numBarriers = 1 + Math.floor(Math.random() * (i + currentOrbitIndex));
- if (self.numBarriers > 12) {
- self.numBarriers = 12;
+ // TODO: there should be much fewer barriers spawned, especially when many of them are static.
+ //self.numBarriers = 1 + Math.floor(Math.random() * (i + currentOrbitIndex));
+ 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();
}
//self.barrierSpeed = Math.random() * currentOrbitIndex + 1 / 20;
- self.barrierSpeed = 0.01 + Math.random() * 0.015 * self.direction;
+ // TODO: Insert logic here to determine speed of enemies in this orbit.
+ // 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 enemySpeed is then incremented every 10 obits or so.
+ self.barrierSpeed = enemySpeed * Math.random() * self.direction;
+ }
+ //self.barrierSpeed = 0.01 + Math.random() * 0.015 * self.direction;
for (var j = 0; j < this.numBarriers; j++) {
self.addBarrier(self.barrierSpeed, j);
//console.log('adding barrier: ', j);
}
@@ -111,9 +152,11 @@
}
};
self.addCollectible = function () {
var collectible = new Collectible();
- collectible.orbitSpeed = 0.01 + Math.random() * 0.015 * self.direction;
+ // 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 = Math.random() * (Math.PI * 2);
self.addChild(collectible);
obstacles.push(collectible);
};
@@ -150,8 +193,10 @@
});
// Initialize player
/****
TODO:
+* What if holding mouse down didn't just stall movement, but move player the other way?
+* Maybe rotate enemies a little bit every frame, back and forth, so that they seem more alive and less alike. (Looks a bit silly).
* Update the instructions to explain the new hold to stall mechanic.
* Maybe only allow hold for as long as collected energy from collectibels allows? Show a draining meter live when player holds.
* I often accidently press play again on game over, so maybe make an extra screen before gameover is shown.
* Collectibles and a shop (but a shop for what?) Lives?
@@ -242,8 +287,9 @@
/****
* Game Code
****/
+var maxEnemiesPerOrbit = 2;
var fullscreenBackground = LK.getAsset('fullscreenBackground', {
anchorX: 0.507,
anchorY: 0.46,
x: 2048 / 2,
@@ -335,9 +381,10 @@
// Initialize assets used in this game.
// Game variables
var player;
var playerSpeed = 1;
-var enemySpeed = 1;
+var enemySpeed = 0.01;
+var collectiblesCollected = 0;
var orbits = [];
var obstacles = [];
var currentOrbitIndex = 0;
var scaling = false;
@@ -520,8 +567,9 @@
}
} else if (obstacles[i] instanceof Collectible) {
obstacles[i].destroy();
obstacles[i]._destroyed = true;
+ collectiblesCollected++;
LK.effects.flashScreen(0x0000ff, 300);
} else {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
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.