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
@@ -1,13 +1,18 @@
/****
+* Plugins
+****/
+var storage = LK.import("@upit/storage.v1");
+
+/****
* Classes
****/
/****
TODO:
-* Instead of white flash on powerup, use particle explosion effect on all enemies.
+* SFX: Maybe jump sound is a bit monotonous. Maybe I could cut different pitches from a soundmap (like a chord progresion)
+* Instead of white flash on powerup, use particle explosion effect on all enemies. (Doesn't work, for some reason.)
* Maybe give player 3 lives? That refill by collecting energy?
* Maybe turret enemy can be used, if it's changed somehow?
-* Sound & Music.
****/
var Collectible = Container.expand(function (i) {
var self = Container.call(this);
var particleGraphics = self.attachAsset('energyPill', {
@@ -67,8 +72,9 @@
self.radius = 880;
//self.angleSpeed = 0.01;
//self.orbitSpeed = 0.075;
self.orbitSpeed = 0.01; //0.055;
+ self.soundPlayed = false;
self.initialPosition = function (angle) {
self.angle = angle;
self.x = self.radius * Math.cos(self.angle);
self.y = self.radius * Math.sin(self.angle);
@@ -84,8 +90,12 @@
self.radius += Math.sin((LK.ticks + (self.index + 1) * 10) * 0.1) * 2; // Adjust radius for wavelike movement
//self.rotation += 0.1;
// If in the player's orbit.
if (self.parent == orbits[currentOrbitIndex]) {
+ if (!self.soundPlayed) {
+ self.soundPlayed = true;
+ LK.getSound('dragonSound').play();
+ }
if (LK.ticks % 15 == 0) {
// Increase speed every 15 ticks.
self.orbitSpeed += 0.0025;
}
@@ -134,12 +144,10 @@
var FloatingText = Container.expand(function (text, x, y) {
var self = Container.call(this);
var textLabel = new Text2(text, {
size: 100,
- fill: "#8888ff",
- align: 'center',
- stroke: "#000000",
- strokeThickness: 5
+ fill: 0x8888FF,
+ align: 'center'
});
textLabel.anchor.set(0.5, 0.5);
textLabel.x = x;
textLabel.y = y;
@@ -164,12 +172,10 @@
bgGraphics.x = centerX;
bgGraphics.y = centerY;
var text = new Text2("Orbits jumped: ".concat(orbitsJumped, "\nEnergy collected: ").concat(energyCollected, "\nFinal score: (").concat(orbitsJumped, "+").concat(energyCollected, ") = ").concat(finalScore), {
size: 100,
- fill: "#ffffff",
- align: 'center',
- stroke: "#000000",
- strokeThickness: 5
+ fill: 0xFFFFFF,
+ align: 'center'
});
text.anchor.set(0.5, 0.5);
text.x = 2048 / 2;
text.y = 2732 / 2;
@@ -235,8 +241,9 @@
anchorX: 0.5,
anchorY: 0.5
});
self.exploding = false;
+ self.soundPlayed = false;
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.radius = 0;
self.initialPosition = function (speed, angle, radius) {
@@ -252,8 +259,12 @@
self.x = self.radius * Math.cos(self.angle);
self.y = self.radius * Math.sin(self.angle);
self.rotation = Math.atan2(0 - self.y, 0 - self.x);
if (self.parent == orbits[currentOrbitIndex]) {
+ if (!self.soundPlayed) {
+ self.soundPlayed = true;
+ LK.getSound('explodingObstacleSound').play();
+ }
//self.exploding = true;
self.parent.addFragment(self.angle, self.orbitSpeed);
self.parent.addFragment(self.angle, self.orbitSpeed * -1);
for (var i = 0; i < 10; i++) {
@@ -301,8 +312,9 @@
self.obstacleGraphics2 = self.attachAsset('obstacleSeeker2', {
anchorX: 0.5,
anchorY: 0.5
});
+ self.soundPlayer = false;
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;
self.radius = 0;
@@ -327,29 +339,18 @@
self._move_migrated = function () {
self.determineDirection();
//only move if player is one the same orbit.
if (self.parent == orbits[currentOrbitIndex]) {
+ if (!self.soundPlayed) {
+ self.soundPlayed = true;
+ LK.getSound('seekerAlertSound').play();
+ }
self.obstacleGraphics2.alpha = 1;
self.obstacleGraphics.alpha = 0;
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 (ENEMY_WOBBLE) {
- 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;
- }
- }
- }
} else {
self.obstacleGraphics2.alpha = 0;
self.obstacleGraphics.alpha = 1;
}
@@ -430,9 +431,16 @@
self.positionOrbit = function (i) {
// Set position and scale.
self.x = centerX;
self.y = centerY;
- self.width = self.height = 1900 - i * 500;
+ //self.width = self.height = 1900 - i * 500;
+ self.width = 1900 - i * 500;
+ self.height = self.width;
+ if (i == 4) {
+ //self.width = 100;
+ //self.height = 100;
+ }
+ console.log("Orbit created with id, x, y, width, height:", i, self.x, self.y, self.width, self.height);
self.barrierSpeed = maxEnemySpeed * Math.random() * self.direction;
// First orbit is always empty.
if (i == 0) {
return;
@@ -642,8 +650,12 @@
self.height = self.width;
scaling = true;
LK.setScore(LK.getScore() + 1);
scoreText.setText(LK.getScore());
+ if (LK.getScore() > storage.bestScore) {
+ storage.bestScore = LK.getScore();
+ bestScoreTxt.setText('Best Score\n' + storage.bestScore);
+ }
/*
var orbit = game.addChild(new Orbit());
orbit.positionOrbit(4);
orbits.push(orbit);
@@ -759,8 +771,9 @@
/****
* Game Code
****/
+// Import storage plugin
LK.playMusic('backgroundMusic');
var centerX = 2048 / 2;
var centerY = 2732 / 2;
var ENEMY_WOBBLE = false;
@@ -786,16 +799,16 @@
var powerup1Activated = false;
var numColors = 18;
var orbitsCreated = 0; //Math.floor(Math.random() * numColors);
var colorOffset = Math.floor(Math.random() * numColors);
-var rainbowColors = function () {
+/*var rainbowColors = function () {
var colors = [];
for (var i = 0; i < numColors; i++) {
var hue = i * (360 / numColors) % 360;
colors.push(hsvToHex(hue / 360, 1, 1));
}
return colors;
-}();
+}();*/
var fullscreenBackground = LK.getAsset('fullscreenBackground', {
anchorX: 0.507,
anchorY: 0.46,
x: 2048 / 2,
@@ -835,8 +848,19 @@
return hex.length === 1 ? '0' + hex : hex;
};
return '0x' + toHex(r) + toHex(g) + toHex(b);
}
+var rainbowColors = [];
+function makeRainbowColors() {
+ var colors = [];
+ for (var i = 0; i < numColors; i++) {
+ var hue = i * (360 / numColors) % 360;
+ colors.push(hsvToHex(hue / 360, 1, 1));
+ }
+ return colors;
+}
+;
+rainbowColors = makeRainbowColors();
//console.log(rainbowColors);
// A for our purposes optimized hitdetection, based on orbit layer and angle.
var radIntersects = function radIntersects(p, t) {
if (t.parent == orbits[currentOrbitIndex]) {
@@ -853,12 +877,10 @@
};
var showPowerupText = function showPowerupText() {
powerupText = new Text2('Powerup Activated!\nAll visible obstacles cleared!\nTap to continue', {
size: 100,
- fill: "#bbbbbb",
- align: 'center',
- stroke: "#000000",
- strokeThickness: 10
+ fill: 0xBBBBBB,
+ align: 'center'
});
powerupText.y = 2700 / 2;
powerupText.x = 2048 / 2;
powerupText.anchor.set(0.5, 0.5);
@@ -887,30 +909,38 @@
// Game variables
var scoreText = new Text2('0', {
size: 150,
align: 'center',
- fill: "#ffffff",
- stroke: "#000000",
- strokeThickness: 20,
+ fill: 0xFFFFFF,
anchorX: 0.5
});
LK.gui.top.addChild(scoreText);
scoreText.x -= 40;
+var bestScoreTxt = new Text2('Best Score\n0', {
+ size: 50,
+ fill: 0xFFFFFF,
+ align: 'center'
+});
+bestScoreTxt.x = 2048 - 300;
+bestScoreTxt.y = 50;
+storage.bestScore = storage.bestScore || 0;
+bestScoreTxt.setText('Best Score\n' + storage.bestScore);
+game.addChild(bestScoreTxt);
// Initialize orbits
function createOrbits() {
for (var i = 0; i < 5; i++) {
- var orbit = game.addChild(new Orbit());
+ var orbit = new Orbit();
orbit.positionOrbit(i);
orbits.push(orbit);
+ game.addChild(orbit);
}
}
createOrbits();
// Add instruction text at the bottom of the screen
var instructionText = new Text2('Tap and release to jump to the next orbit.\nCollect blue energy and don\'t hit the red obstacles.', {
size: 50,
- fill: "#bbbbbb",
- align: 'center',
- strokeThickness: 10
+ fill: 0xBBBBBB,
+ align: 'center'
});
instructionText.y = 163;
instructionText.x = 50;
instructionText.anchor.set(0.5, 0);
@@ -990,8 +1020,9 @@
}
if (stalling) {
stalling = false;
}
+ game.addChild(bestScoreTxt);
}
});
LK.on('tick', function () {
if (!GAME_ENDED) {
@@ -1000,11 +1031,17 @@
}
var t;
if (powerup1Activated) {
powerup1Activated = false;
- for (var i = obstacles.length - 1; i > 0; i--) {
+ for (var i = obstacles.length - 1; i >= 0; i--) {
t = obstacles[i];
if (t instanceof Collectible == false) {
+ /*
+ for (var j = 0; j < 5; j++) {
+ var angle = j / 5 * Math.PI * 2;
+ var trail = new ExplosionTrail(t.parent.x + t.x + Math.cos(angle) * 5, t.parent.y + t.y + Math.sin(angle) * 5);
+ game.addChild(trail);
+ }*/
t.destroy();
t._destroyed = true;
}
}
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.