/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var EnergyOrb = Container.expand(function () {
var self = Container.call(this);
var orbGraphics = self.attachAsset('energyOrb', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 4;
self.collected = false;
self.update = function () {
self.y += self.speed;
// Floating animation
orbGraphics.y = Math.sin(LK.ticks * 0.2 + self.x * 0.01) * 10;
// Glow effect
orbGraphics.alpha = 0.7 + Math.sin(LK.ticks * 0.15) * 0.3;
orbGraphics.scaleX = 0.8 + Math.sin(LK.ticks * 0.1) * 0.2;
orbGraphics.scaleY = 0.8 + Math.sin(LK.ticks * 0.1) * 0.2;
};
return self;
});
var Obstacle = Container.expand(function (type) {
var self = Container.call(this);
var obstacleGraphics = self.attachAsset(type, {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 6;
self.type = type;
self.update = function () {
self.y += self.speed;
// Add rotation for visual effect
obstacleGraphics.rotation += 0.05;
// Pulse effect
var pulse = 0.8 + Math.sin(LK.ticks * 0.1) * 0.2;
obstacleGraphics.scaleX = pulse;
obstacleGraphics.scaleY = pulse;
};
return self;
});
var Ship = Container.expand(function () {
var self = Container.call(this);
var shipGraphics = self.attachAsset('ship', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 8;
self.targetX = 0;
self.targetY = 0;
self.update = function () {
// Smooth movement towards target position
var dx = self.targetX - self.x;
var dy = self.targetY - self.y;
self.x += dx * 0.15;
self.y += dy * 0.15;
// Keep ship within bounds
self.x = Math.max(100, Math.min(1948, self.x));
self.y = Math.max(100, Math.min(2632, self.y));
// Add subtle glow effect
shipGraphics.alpha = 0.8 + Math.sin(LK.ticks * 0.1) * 0.2;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000a1a
});
/****
* Game Code
****/
var ship;
var obstacles = [];
var energyOrbs = [];
var gameSpeed = 1;
var spawnTimer = 0;
var orbSpawnTimer = 0;
var scoreMultiplier = 1;
var distanceScore = 0;
var dragNode = null;
// Initialize ship
ship = game.addChild(new Ship());
ship.x = 1024;
ship.y = 2200;
ship.targetX = ship.x;
ship.targetY = ship.y;
// Score display
var scoreTxt = new Text2('Score: 0', {
size: 80,
fill: 0x00FFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Multiplier display
var multiplierTxt = new Text2('x1', {
size: 60,
fill: 0x00FF00
});
multiplierTxt.anchor.set(1, 0);
LK.gui.topRight.addChild(multiplierTxt);
function handleMove(x, y, obj) {
if (dragNode) {
dragNode.targetX = x;
dragNode.targetY = y;
}
}
game.move = handleMove;
game.down = function (x, y, obj) {
dragNode = ship;
handleMove(x, y, obj);
};
game.up = function (x, y, obj) {
dragNode = null;
};
function spawnObstacle() {
var types = ['triangle', 'square', 'diamond'];
var type = types[Math.floor(Math.random() * types.length)];
var obstacle = new Obstacle(type);
obstacle.x = Math.random() * 1800 + 124;
obstacle.y = -100;
obstacle.speed = 6 + gameSpeed * 2;
obstacles.push(obstacle);
game.addChild(obstacle);
}
function spawnEnergyOrb() {
var orb = new EnergyOrb();
orb.x = Math.random() * 1800 + 124;
orb.y = -100;
orb.speed = 4 + gameSpeed;
energyOrbs.push(orb);
game.addChild(orb);
}
game.update = function () {
// Increase game speed over time
gameSpeed += 0.002;
// Update distance score
distanceScore += gameSpeed;
// Spawn obstacles
spawnTimer++;
if (spawnTimer >= Math.max(30 - gameSpeed * 2, 15)) {
spawnObstacle();
spawnTimer = 0;
}
// Spawn energy orbs
orbSpawnTimer++;
if (orbSpawnTimer >= Math.max(180 - gameSpeed * 5, 60)) {
spawnEnergyOrb();
orbSpawnTimer = 0;
}
// Update obstacles
for (var i = obstacles.length - 1; i >= 0; i--) {
var obstacle = obstacles[i];
if (obstacle.lastY === undefined) obstacle.lastY = obstacle.y;
if (obstacle.lastIntersecting === undefined) obstacle.lastIntersecting = false;
// Remove off-screen obstacles
if (obstacle.lastY <= 2800 && obstacle.y > 2800) {
obstacle.destroy();
obstacles.splice(i, 1);
continue;
}
// Check collision with ship
var currentIntersecting = obstacle.intersects(ship);
if (!obstacle.lastIntersecting && currentIntersecting) {
LK.getSound('hit').play();
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
return;
}
obstacle.lastY = obstacle.y;
obstacle.lastIntersecting = currentIntersecting;
}
// Update energy orbs
for (var j = energyOrbs.length - 1; j >= 0; j--) {
var orb = energyOrbs[j];
if (orb.lastY === undefined) orb.lastY = orb.y;
if (orb.lastIntersecting === undefined) orb.lastIntersecting = false;
// Remove off-screen orbs
if (orb.lastY <= 2800 && orb.y > 2800) {
orb.destroy();
energyOrbs.splice(j, 1);
continue;
}
// Check collection
var currentIntersecting = orb.intersects(ship);
if (!orb.lastIntersecting && currentIntersecting && !orb.collected) {
orb.collected = true;
LK.getSound('collect').play();
scoreMultiplier = Math.min(scoreMultiplier + 0.1, 5);
// Visual effect
LK.effects.flashObject(orb, 0x00ff00, 300);
tween(orb, {
alpha: 0,
scaleX: 2,
scaleY: 2
}, {
duration: 300,
onFinish: function onFinish() {
orb.destroy();
}
});
energyOrbs.splice(j, 1);
continue;
}
orb.lastY = orb.y;
orb.lastIntersecting = currentIntersecting;
}
// Update score
var totalScore = Math.floor(distanceScore * scoreMultiplier);
LK.setScore(totalScore);
scoreTxt.setText('Score: ' + totalScore);
multiplierTxt.setText('x' + scoreMultiplier.toFixed(1));
// Add screen shake effect at higher speeds
if (gameSpeed > 3) {
var shake = Math.sin(LK.ticks * 0.3) * (gameSpeed - 3) * 2;
game.x = shake;
}
};
// Start background music
LK.playMusic('bgmusic'); ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,228 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+var EnergyOrb = Container.expand(function () {
+ var self = Container.call(this);
+ var orbGraphics = self.attachAsset('energyOrb', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 4;
+ self.collected = false;
+ self.update = function () {
+ self.y += self.speed;
+ // Floating animation
+ orbGraphics.y = Math.sin(LK.ticks * 0.2 + self.x * 0.01) * 10;
+ // Glow effect
+ orbGraphics.alpha = 0.7 + Math.sin(LK.ticks * 0.15) * 0.3;
+ orbGraphics.scaleX = 0.8 + Math.sin(LK.ticks * 0.1) * 0.2;
+ orbGraphics.scaleY = 0.8 + Math.sin(LK.ticks * 0.1) * 0.2;
+ };
+ return self;
+});
+var Obstacle = Container.expand(function (type) {
+ var self = Container.call(this);
+ var obstacleGraphics = self.attachAsset(type, {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 6;
+ self.type = type;
+ self.update = function () {
+ self.y += self.speed;
+ // Add rotation for visual effect
+ obstacleGraphics.rotation += 0.05;
+ // Pulse effect
+ var pulse = 0.8 + Math.sin(LK.ticks * 0.1) * 0.2;
+ obstacleGraphics.scaleX = pulse;
+ obstacleGraphics.scaleY = pulse;
+ };
+ return self;
+});
+var Ship = Container.expand(function () {
+ var self = Container.call(this);
+ var shipGraphics = self.attachAsset('ship', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 8;
+ self.targetX = 0;
+ self.targetY = 0;
+ self.update = function () {
+ // Smooth movement towards target position
+ var dx = self.targetX - self.x;
+ var dy = self.targetY - self.y;
+ self.x += dx * 0.15;
+ self.y += dy * 0.15;
+ // Keep ship within bounds
+ self.x = Math.max(100, Math.min(1948, self.x));
+ self.y = Math.max(100, Math.min(2632, self.y));
+ // Add subtle glow effect
+ shipGraphics.alpha = 0.8 + Math.sin(LK.ticks * 0.1) * 0.2;
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x000a1a
+});
+
+/****
+* Game Code
+****/
+var ship;
+var obstacles = [];
+var energyOrbs = [];
+var gameSpeed = 1;
+var spawnTimer = 0;
+var orbSpawnTimer = 0;
+var scoreMultiplier = 1;
+var distanceScore = 0;
+var dragNode = null;
+// Initialize ship
+ship = game.addChild(new Ship());
+ship.x = 1024;
+ship.y = 2200;
+ship.targetX = ship.x;
+ship.targetY = ship.y;
+// Score display
+var scoreTxt = new Text2('Score: 0', {
+ size: 80,
+ fill: 0x00FFFF
+});
+scoreTxt.anchor.set(0.5, 0);
+LK.gui.top.addChild(scoreTxt);
+// Multiplier display
+var multiplierTxt = new Text2('x1', {
+ size: 60,
+ fill: 0x00FF00
+});
+multiplierTxt.anchor.set(1, 0);
+LK.gui.topRight.addChild(multiplierTxt);
+function handleMove(x, y, obj) {
+ if (dragNode) {
+ dragNode.targetX = x;
+ dragNode.targetY = y;
+ }
+}
+game.move = handleMove;
+game.down = function (x, y, obj) {
+ dragNode = ship;
+ handleMove(x, y, obj);
+};
+game.up = function (x, y, obj) {
+ dragNode = null;
+};
+function spawnObstacle() {
+ var types = ['triangle', 'square', 'diamond'];
+ var type = types[Math.floor(Math.random() * types.length)];
+ var obstacle = new Obstacle(type);
+ obstacle.x = Math.random() * 1800 + 124;
+ obstacle.y = -100;
+ obstacle.speed = 6 + gameSpeed * 2;
+ obstacles.push(obstacle);
+ game.addChild(obstacle);
+}
+function spawnEnergyOrb() {
+ var orb = new EnergyOrb();
+ orb.x = Math.random() * 1800 + 124;
+ orb.y = -100;
+ orb.speed = 4 + gameSpeed;
+ energyOrbs.push(orb);
+ game.addChild(orb);
+}
+game.update = function () {
+ // Increase game speed over time
+ gameSpeed += 0.002;
+ // Update distance score
+ distanceScore += gameSpeed;
+ // Spawn obstacles
+ spawnTimer++;
+ if (spawnTimer >= Math.max(30 - gameSpeed * 2, 15)) {
+ spawnObstacle();
+ spawnTimer = 0;
+ }
+ // Spawn energy orbs
+ orbSpawnTimer++;
+ if (orbSpawnTimer >= Math.max(180 - gameSpeed * 5, 60)) {
+ spawnEnergyOrb();
+ orbSpawnTimer = 0;
+ }
+ // Update obstacles
+ for (var i = obstacles.length - 1; i >= 0; i--) {
+ var obstacle = obstacles[i];
+ if (obstacle.lastY === undefined) obstacle.lastY = obstacle.y;
+ if (obstacle.lastIntersecting === undefined) obstacle.lastIntersecting = false;
+ // Remove off-screen obstacles
+ if (obstacle.lastY <= 2800 && obstacle.y > 2800) {
+ obstacle.destroy();
+ obstacles.splice(i, 1);
+ continue;
+ }
+ // Check collision with ship
+ var currentIntersecting = obstacle.intersects(ship);
+ if (!obstacle.lastIntersecting && currentIntersecting) {
+ LK.getSound('hit').play();
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.showGameOver();
+ return;
+ }
+ obstacle.lastY = obstacle.y;
+ obstacle.lastIntersecting = currentIntersecting;
+ }
+ // Update energy orbs
+ for (var j = energyOrbs.length - 1; j >= 0; j--) {
+ var orb = energyOrbs[j];
+ if (orb.lastY === undefined) orb.lastY = orb.y;
+ if (orb.lastIntersecting === undefined) orb.lastIntersecting = false;
+ // Remove off-screen orbs
+ if (orb.lastY <= 2800 && orb.y > 2800) {
+ orb.destroy();
+ energyOrbs.splice(j, 1);
+ continue;
+ }
+ // Check collection
+ var currentIntersecting = orb.intersects(ship);
+ if (!orb.lastIntersecting && currentIntersecting && !orb.collected) {
+ orb.collected = true;
+ LK.getSound('collect').play();
+ scoreMultiplier = Math.min(scoreMultiplier + 0.1, 5);
+ // Visual effect
+ LK.effects.flashObject(orb, 0x00ff00, 300);
+ tween(orb, {
+ alpha: 0,
+ scaleX: 2,
+ scaleY: 2
+ }, {
+ duration: 300,
+ onFinish: function onFinish() {
+ orb.destroy();
+ }
+ });
+ energyOrbs.splice(j, 1);
+ continue;
+ }
+ orb.lastY = orb.y;
+ orb.lastIntersecting = currentIntersecting;
+ }
+ // Update score
+ var totalScore = Math.floor(distanceScore * scoreMultiplier);
+ LK.setScore(totalScore);
+ scoreTxt.setText('Score: ' + totalScore);
+ multiplierTxt.setText('x' + scoreMultiplier.toFixed(1));
+ // Add screen shake effect at higher speeds
+ if (gameSpeed > 3) {
+ var shake = Math.sin(LK.ticks * 0.3) * (gameSpeed - 3) * 2;
+ game.x = shake;
+ }
+};
+// Start background music
+LK.playMusic('bgmusic');
\ No newline at end of file
Neon diamond. In-Game asset. 2d. High contrast. No shadows
Neon energy orb. In-Game asset. 2d. High contrast. No shadows
Neon square. In-Game asset. 2d. High contrast. No shadows
Neon paper airplane. In-Game asset. 2d. High contrast. No shadows
Neon triangle. In-Game asset. 2d. High contrast. No shadows