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
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Point is not a constructor' in or related to this line: 'var globalPlayerPosition = player.toGlobal(new Point(0, 0));' Line Number: 307
User prompt
please factor into the lookatplayer and shootatplayer functions, that they should work in the global scope, because player and the turretobstacle can be children of different containers.
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: speed is not defined' in or related to this line: 'turret.initialPosition(speed, angle, radius);' Line Number: 444
Code edit (1 edits merged)
Please save this source code
Code edit (20 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -3,22 +3,14 @@
****/
/****
/****
TODO:
-* level system to determine orbit order.
-* Make turretshots lethal.
-* Need fresh eyes on this tomorrow. I feel there's perhaps some uncanny valley effect going on, where adding richness
- just makes it look more like a cheap version of something really cool, whereas the simple look made it feel like
- it over-delivered on gameplay, compared to how it looked.
-* Make some orbits with many evenly spread collectibles.
+* Stop the player glow after death - maybe replace with some other effect- like explosion.
+* Make turretshots lethal.(Or rework them
* Try to think up a few more enemy types. Might need to slow difficulty progression down a bit to introduce them.
-* Dragon could have some special behaviour, so it's not just a fancy graphic, but a new gameplay element. Maybe it could
- only spawn in orbits with a lot of energy, that it eats as it passes by them, and if it eats them all before player bypasses
- it, it explodes in an area-attack? Spanning many orbits?
* What if holding mouse down didn't just stall movement, but move player the other way?
* Update the instructions to explain the new hold to stall mechanic.
* Maybe give player 3 lives.
-* Figure out why stuff shows up in the center on start?
* Sound & Music.
* Would also be cool to be able to jump in AND out of orbits, but hard to implement. Or maybe just tap on the orbit to go to?
****/
var Collectible = Container.expand(function (i) {
@@ -26,11 +18,17 @@
var particleGraphics = self.attachAsset('energyPill', {
anchorX: 0.5,
anchorY: 0.5
});
- self.orbitSpeed = 0; // set by the orbit that spawns it.
+ self.orbitSpeed; // = 0; // set by the orbit that spawns it.
self.growing = Math.random() <= 0.5 ? true : false;
- self.radius = 0;
+ self.radius; // = 0;
+ self.initialPosition = function (radius, angle) {
+ self.angle = angle;
+ self.radius = radius;
+ self.x = self.radius * Math.cos(self.angle);
+ self.y = self.radius * Math.sin(self.angle);
+ };
self._move_migrated = function () {
/*if (self.parent) {
self.radius = self.parent.width / 2 * (1900 / self.parent.width) - self.width / 2 * (100 / self.width);
}*/
@@ -89,8 +87,15 @@
//var sway = Math.cos((LK.ticks + self.index) % 100) * 2;
//self.radius += sway;
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 (LK.ticks % 15 == 0) {
+ // Increase speed every 15 ticks.
+ self.orbitSpeed += 0.0025;
+ }
+ }
if (self.head) {
self.parent.addChild(self);
if (self.x < centerX) {
//self.rotation = self.angle;
@@ -298,8 +303,9 @@
var shotGraphics = turretShot.attachAsset('turretShot', {
anchorX: 0.5,
anchorY: 0.5
});
+ turretShot.dead = false;
turretShot.x = (self.x + self.parent.x) / self.parent.scale.x;
turretShot.y = (self.y + self.parent.y) / self.parent.scale.y;
turretShot.rotation = playerAngle + Math.PI / 2;
turretShot.speedX = Math.cos(playerAngle) * 10;
@@ -307,12 +313,14 @@
turretShot.update = function () {
turretShot.x += turretShot.speedX;
turretShot.y += turretShot.speedY;
if (turretShot.x < 0 || turretShot.x > 2048 || turretShot.y < 0 || turretShot.y > 2732) {
+ turretShot.dead = true;
turretShot.destroy();
}
};
game.addChild(turretShot);
+ turretShots.push(turretShot);
//obstacles.push(turretShot);
};
self._move_migrated = function () {
self.lookAtPlayer();
@@ -347,19 +355,67 @@
// Set position and scale.
self.x = centerX;
self.y = centerY;
self.width = self.height = 1900 - i * 500;
+ self.barrierSpeed = maxEnemySpeed * Math.random() * self.direction;
// First orbit is always empty.
if (i == 0) {
return;
}
// Determine contents of this orbit.
// Every 17th orbit is reserved for a powerup.
if (orbitsCreated % 17 == 0) {
- self.addCollectible(10);
+ self.addCollectible(1);
self.addPowerup();
return;
}
+ if (orbitsCreated > 50) {
+ // Turret enemy possible.
+ if (Math.random() < 0.1) {
+ var amount = Math.ceil(Math.random() * 3);
+ self.addCollectible(amount);
+ for (var i = 0; i < amount; i++) {
+ self.addObstacleTurret();
+ }
+ return;
+ }
+ }
+ if (orbitsCreated > 40) {
+ // Dragon enemy possible.
+ if (Math.random() < 0.1) {
+ self.addCollectible(10);
+ self.addDragon();
+ return;
+ }
+ }
+ if (orbitsCreated > 30) {
+ // Seeker enemy possible.
+ if (Math.random() < 0.1) {
+ self.addCollectible(1);
+ for (var i = 0; i < 2; i++) {
+ self.addSeekerObstacle(self.barrierSpeed, i);
+ }
+ return;
+ }
+ }
+ if (orbitsCreated > 20) {
+ // Static enemy possible
+ if (Math.random() < 0.2) {
+ self.addCollectible(1);
+ self.numBarriers = Math.ceil(Math.random() * maxEnemiesPerOrbit);
+ self.barrierSpeed = 0; // Setting speed to 0 makes the barrier the static type.
+ for (var i = 0; i < this.numBarriers; i++) {
+ self.addBarrier(self.barrierSpeed, i);
+ }
+ return;
+ }
+ }
+ // Default case, spawn X normal enemies
+ self.addCollectible(1);
+ self.numBarriers = Math.ceil(Math.random() * maxEnemiesPerOrbit);
+ for (var i = 0; i < this.numBarriers; i++) {
+ self.addBarrier(self.barrierSpeed, i);
+ }
};
self.OBS_positionOrbit = function (i) {
self.x = 2048 / 2;
self.y = 2732 / 2;
@@ -471,10 +527,12 @@
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 = Math.PI * 2 / i; //Math.random() * (Math.PI * 2);
- collectible.radius = 880;
+ //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);
}
};
@@ -583,8 +641,68 @@
self.y = self.radius * Math.sin(self.angle);
self.rotation += 0.1;
};
});
+var Sparkle = Container.expand(function () {
+ var self = Container.call(this);
+ var obstacleGraphics = self.attachAsset('sparkle', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ //tint: Math.floor(Math.random() * 16777215) // Add random tint
+ });
+ //self.angleSpeed = 0.01;
+ self.angle = 0;
+ self.orbitSpeed = (0.5 - Math.random() * 1) * 0.2; //-0.01;
+ self.radius = 0;
+ self.spread = Math.random() * 6 + 1;
+ self.centerX = 2048 / 2;
+ self.centerY = 2720 / 2;
+ self.moveAround = function () {
+ // Obstacle move logic
+ //var angleSpeed = -0.01 * self.parent.direction; //self.orbitSpeed;
+ //self.radius = self.parent.width / 2 - self.width / 2;
+ //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;
+ var oldX = self.x;
+ var oldY = self.y;
+ self.x = self.centerX + self.radius * Math.cos(self.angle);
+ self.y = self.centerY + self.radius * Math.sin(self.angle);
+ /*
+ // Create a trail effect
+ if (LK.ticks % 3 == 0) {
+ var trail = LK.getAsset('trail', {
+ x: oldX,
+ y: oldY,
+ width: 4,
+ height: 4,
+ anchorX: 0.5,
+ anchorY: 0.5
+ //tint: Math.floor(Math.random() * 16777215) // Add random tint
+ });
+ game.addChild(trail);
+ //trails.push(trail);
+ // Fade out and remove the trail after a short duration
+ LK.setTimeout(function () {
+ game.removeChild(trail);
+ }, 50);
+ }
+ */
+ if (true || Math.random() < 0.9) {
+ self.radius += self.spread;
+ }
+ //self.radius += 2 + Math.sin(LK.ticks % 20);
+ if (self.x > 2060 || self.x < -2060 || self.y < -60 || self.y > 2800) {
+ self.x = self.centerX;
+ self.y = self.centerY;
+ self.angle = 0;
+ self.orbitSpeed = (0.5 - Math.random() * 1) * 0.2; //-0.01;
+ self.radius = 0;
+ self.spread = Math.random() * 10 + 1;
+ game.addChild(self);
+ }
+ };
+});
/****
* Initialize Game
****/
@@ -598,8 +716,9 @@
var centerX = 2048 / 2;
var centerY = 2732 / 2;
var ENEMY_WOBBLE = false;
var PARTICLES_ON = true;
+var SPARKLES_ON = true;
var INCREASE_DIFFICULTY_EVERY_X_LEVELS = 15;
var GAME_ENDED = false;
var maxEnemiesPerOrbit = 2;
var player;
@@ -607,8 +726,9 @@
var maxEnemySpeed = 0.01;
var collectiblesCollected = 0;
var orbits = [];
var obstacles = [];
+var turretShots = [];
var currentOrbitIndex = 0;
var scaling = false;
var scalingCounter = 0;
var scalingSpeed = 50;
@@ -736,12 +856,13 @@
}
}
createOrbits();
// Add instruction text at the bottom of the screen
-var instructionText = new Text2('Tap to jump to the next orbit.\nDon\'t hit the red obstacles.', {
+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'
+ align: 'center',
+ strokeThickness: 10
});
instructionText.y = 163;
instructionText.x = 50;
instructionText.anchor.set(0.5, 0);
@@ -768,8 +889,16 @@
particleContainer.addChild(particle);
particles.push(particle);
}
}
+var sparkles = [];
+if (SPARKLES_ON) {
+ for (var i = 0; i < 50; i++) {
+ var sparkle = game.addChild(new Sparkle());
+ //sparkles.positionOrbit(i);
+ sparkles.push(sparkle);
+ }
+}
//player.x = 2048 / 2;
//player.y = 2732 / 2 - 200; // Start the player 200px above the center
/*
console.log('Player radius is now: ' + player.radius);
@@ -864,17 +993,17 @@
*/
}
}
// Update orbits
- for (var i = orbits.length - 1; i > 0; i--) {
+ for (var i = orbits.length - 1; i >= 0; i--) {
//orbits[i].positionOrbit(i);
var orb = orbits[i];
//if (orb && orb.width > 2700) {
if (orb && orb.width > 3500) {
for (var j = 0; j < orb.children.length; j++) {
t = orb.children[j];
if (t instanceof Obstacle || t instanceof Powerup1) {
- // child is an instance of YourClass, do something with it
+ // child is an instance of these, do something with it
t._destroyed = true;
}
}
//orbits[i].destroy();
@@ -884,9 +1013,9 @@
currentOrbitIndex--;
}
}
// Update obstacles
- for (var i = obstacles.length - 1; i > 0; i--) {
+ for (var i = obstacles.length - 1; i >= 0; i--) {
t = obstacles[i];
//if (obstacles[i] && !obstacles[i]._destroyed) {
if (t && !t._destroyed) {
//obstacles[i]._move_migrated();
@@ -936,11 +1065,29 @@
obstacles.splice(i, 1);
//console.log('obstacles.length is now: ' + obstacles.length);
}
}
+ // Update obstacles
+ for (var i = turretShots.length - 1; i >= 0; i--) {
+ t = turretShots[i];
+ //if (obstacles[i] && !obstacles[i]._destroyed) {
+ if (t.dead == true) {
+ t.destroy();
+ turretShots.splice(i, 1);
+ }
+ }
if (PARTICLES_ON && particles && particles.length > 0) {
for (var i = particles.length - 1; i >= 0; i--) {
particles[i].update();
}
}
+ if (SPARKLES_ON && sparkles && sparkles.length > 0) {
+ for (var i = sparkles.length - 1; i > 0; i--) {
+ if (sparkles[i] && !sparkles[i]._destroyed) {
+ sparkles[i].moveAround();
+ } else {
+ //sparkles.splice(i, 1);
+ }
+ }
+ }
}
});
\ No newline at end of file
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.