User prompt
Make use of the obstacle wall
User prompt
Make the projectile rotate with the yaw angle/the direction its facing
User prompt
Make the danger zone dissapearing make an asset ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make danger zone not transparent and make an effect after it dissapears ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make it not quickly go up when reached 30 points
User prompt
Starting points is 10
User prompt
Make it 10 points each 2 seconds
User prompt
Make 8t work
User prompt
Make it -15 points
User prompt
Make it so if hit by obstacles, -150 points and if equal or less than 0 points, you lose
User prompt
Make obstacles active in every spot
User prompt
Make obstacles ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Pulse Rush
Initial prompt
Make a just shapes and beats type game
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var DangerZone = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('danger_zone', { anchorX: 0.5, anchorY: 0.5 }); self.expandRate = 2; self.maxSize = 400; self.currentSize = 50; self.expanding = true; self.update = function () { if (self.expanding) { self.currentSize += self.expandRate; if (self.currentSize >= self.maxSize) { self.expanding = false; // Smooth transition to warning colors when fully expanded tween(graphics, { tint: 0xff0000, alpha: 0.9 }, { duration: 500, easing: tween.easeInOut }); } } var scale = self.currentSize / 200; graphics.scaleX = scale; graphics.scaleY = scale; // Beat pulse effect with smooth tweening if (beatPulse > 0) { // Intense pulse on beat tween(graphics, { alpha: 1.0, tint: 0xffffff }, { duration: 100, easing: tween.easeOut }); } else if (beatPulse === 0) { // Return to base state var baseAlpha = self.expanding ? 0.4 : 0.7; var baseTint = self.expanding ? 0xff0080 : 0xff0000; tween(graphics, { alpha: baseAlpha, tint: baseTint }, { duration: 300, easing: tween.easeInOut }); } }; return self; }); var ObstacleSpinner = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('obstacle_spinner', { anchorX: 0.5, anchorY: 0.5 }); self.rotationSpeed = 0.02; self.beatScale = 1; self.update = function () { graphics.rotation += self.rotationSpeed; // Beat synchronization with smooth tweening if (beatPulse > 0) { // Smooth scale animation on beat tween(graphics, { scaleX: 1.4, scaleY: 1.4, tint: 0xffffff }, { duration: 200, easing: tween.easeOut }); // Spin faster on beat self.rotationSpeed = 0.05; } else if (beatPulse === 0) { // Return to normal scale tween(graphics, { scaleX: 1, scaleY: 1, tint: 0xff4444 }, { duration: 300, easing: tween.easeInOut }); // Normal rotation speed self.rotationSpeed = 0.02; } }; return self; }); var ObstacleWall = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('obstacle_wall', { anchorX: 0.5, anchorY: 0.5 }); self.moveSpeed = 3; self.direction = 1; // 1 for right, -1 for left self.update = function () { self.x += self.moveSpeed * self.direction; // Beat pulse effect with smooth tweening if (beatPulse > 0) { // Smooth scale and tint animation on beat tween(graphics, { scaleY: 1.5, tint: 0xffffff }, { duration: 150, easing: tween.easeOut }); // Brief speed boost on beat self.moveSpeed = 5; } else if (beatPulse === 0) { // Return to normal scale and tint tween(graphics, { scaleY: 1, tint: 0xff6666 }, { duration: 400, easing: tween.easeInOut }); // Normal speed self.moveSpeed = 3; } // Bounce off screen edges with smooth direction change if (self.x > 2048 - 150 || self.x < 150) { self.direction *= -1; // Add a brief flash when bouncing tween(graphics, { tint: 0xffff00 }, { duration: 100, onFinish: function onFinish() { tween(graphics, { tint: 0xff6666 }, { duration: 200 }); } }); } }; return self; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 8; self.targetX = 0; self.targetY = 0; self.update = function () { // Smooth movement towards target var dx = self.targetX - self.x; var dy = self.targetY - self.y; self.x += dx * 0.15; self.y += dy * 0.15; // Pulse effect on beat with smooth tweening if (beatPulse > 0) { // Energetic pulse on beat tween(playerGraphics, { scaleX: 1.3, scaleY: 1.3, tint: 0xffffff }, { duration: 100, easing: tween.easeOut }); } else if (beatPulse === 0) { // Return to normal state tween(playerGraphics, { scaleX: 1, scaleY: 1, tint: 0x00ff88 }, { duration: 200, easing: tween.easeInOut }); } }; return self; }); var Projectile = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('projectile', { anchorX: 0.5, anchorY: 0.5 }); self.velocityX = 0; self.velocityY = 0; self.lifetime = 300; // ticks self.update = function () { self.x += self.velocityX; self.y += self.velocityY; self.lifetime--; // Beat pulse with smooth tweening if (beatPulse > 0) { // Dramatic scale and color change on beat tween(graphics, { scaleX: 2, scaleY: 2, tint: 0xffffff }, { duration: 150, easing: tween.easeOut }); } else if (beatPulse === 0) { // Return to normal state tween(graphics, { scaleX: 1, scaleY: 1, tint: 0xffaa00 }, { duration: 250, easing: tween.easeInOut }); } // Warning effect when lifetime is low if (self.lifetime < 60 && self.lifetime % 10 === 0) { tween(graphics, { tint: 0xff0000 }, { duration: 100, onFinish: function onFinish() { tween(graphics, { tint: 0xffaa00 }, { duration: 100 }); } }); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x0a0a0a }); /**** * Game Code ****/ // Game variables var player; var obstacles = []; var projectiles = []; var dangerZones = []; var gameTime = 0; var beatCounter = 0; var beatPulse = 0; // 0-1 value for beat synchronization var difficultyLevel = 1; var survivalTime = 0; var scoreMultiplier = 1; // Initialize player player = game.addChild(new Player()); player.x = 1024; player.y = 1366; player.targetX = player.x; player.targetY = player.y; // Score display var scoreTxt = new Text2('0', { size: 120, fill: 0x00FF88 }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Survival time display var timeTxt = new Text2('0s', { size: 80, fill: 0xFFFFFF }); timeTxt.anchor.set(0, 0); timeTxt.x = 200; timeTxt.y = 100; LK.gui.topLeft.addChild(timeTxt); // Beat synchronization var beatTimer = 0; var beatInterval = 30; // ticks between beats (adjust for music tempo) // Obstacle spawn timers var spinnerSpawnTimer = 0; var wallSpawnTimer = 0; var projectileSpawnTimer = 0; var dangerZoneSpawnTimer = 0; // Touch controls game.down = function (x, y, obj) { player.targetX = x; player.targetY = y; }; game.move = function (x, y, obj) { player.targetX = x; player.targetY = y; }; // Spawn functions function spawnSpinner() { var spinner = new ObstacleSpinner(); spinner.x = Math.random() * (2048 - 240) + 120; spinner.y = Math.random() * (2732 - 240) + 120; // Entrance animation spinner.alpha = 0; spinner.scaleX = 0.3; spinner.scaleY = 0.3; tween(spinner, { alpha: 1, scaleX: 1, scaleY: 1 }, { duration: 400, easing: tween.easeOut }); obstacles.push(spinner); game.addChild(spinner); } function spawnWall() { var wall = new ObstacleWall(); wall.x = Math.random() > 0.5 ? 150 : 1898; wall.y = Math.random() * (2732 - 300) + 150; wall.direction = wall.x < 1024 ? 1 : -1; // Entrance animation - slide in from edge var originalX = wall.x; wall.x = wall.direction === 1 ? -300 : 2348; wall.alpha = 0.5; tween(wall, { x: originalX, alpha: 1 }, { duration: 600, easing: tween.easeOut }); obstacles.push(wall); game.addChild(wall); } function spawnProjectile() { var projectile = new Projectile(); // Spawn from edges var side = Math.floor(Math.random() * 4); switch (side) { case 0: // top projectile.x = Math.random() * 2048; projectile.y = -20; break; case 1: // right projectile.x = 2068; projectile.y = Math.random() * 2732; break; case 2: // bottom projectile.x = Math.random() * 2048; projectile.y = 2752; break; case 3: // left projectile.x = -20; projectile.y = Math.random() * 2732; break; } // Aim towards player var dx = player.x - projectile.x; var dy = player.y - projectile.y; var distance = Math.sqrt(dx * dx + dy * dy); var speed = 4 + difficultyLevel; projectile.velocityX = dx / distance * speed; projectile.velocityY = dy / distance * speed; projectiles.push(projectile); game.addChild(projectile); } function spawnDangerZone() { var zone = new DangerZone(); zone.x = Math.random() * (2048 - 400) + 200; zone.y = Math.random() * (2732 - 400) + 200; // Entrance animation - fade in with warning pulse zone.alpha = 0; tween(zone, { alpha: 0.4 }, { duration: 300, easing: tween.easeIn }); // Warning pulse sequence LK.setTimeout(function () { tween(zone, { alpha: 0.8 }, { duration: 200 }); }, 100); LK.setTimeout(function () { tween(zone, { alpha: 0.4 }, { duration: 200 }); }, 300); dangerZones.push(zone); game.addChild(zone); } // Start music LK.playMusic('pulse_track', { loop: true }); // Main game loop game.update = function () { gameTime++; survivalTime = Math.floor(gameTime / 60); // Beat synchronization beatTimer++; if (beatTimer >= beatInterval) { beatTimer = 0; beatCounter++; beatPulse = 1; LK.getSound('beat').play(); // Screen flash on beat if (beatCounter % 4 === 0) { LK.effects.flashScreen(0x00ff88, 100); } } // Decay beat pulse if (beatPulse > 0) { beatPulse -= 0.1; if (beatPulse < 0) beatPulse = 0; } // Increase difficulty over time if (survivalTime > 0 && survivalTime % 15 === 0 && gameTime % 60 === 0) { difficultyLevel = Math.min(5, Math.floor(survivalTime / 15) + 1); beatInterval = Math.max(20, 30 - difficultyLevel); } // Spawn obstacles based on beat and difficulty if (beatPulse === 1) { // On beat if (beatCounter % (6 - difficultyLevel) === 0) { spawnSpinner(); } if (beatCounter % (8 - difficultyLevel) === 0) { spawnWall(); } if (beatCounter % (4 - Math.floor(difficultyLevel / 2)) === 0) { spawnProjectile(); } if (beatCounter % (12 - difficultyLevel) === 0) { spawnDangerZone(); } } // Clean up obstacles for (var i = obstacles.length - 1; i >= 0; i--) { var obstacle = obstacles[i]; // Remove off-screen obstacles if (obstacle.x < -200 || obstacle.x > 2248 || obstacle.y < -200 || obstacle.y > 2932) { obstacle.destroy(); obstacles.splice(i, 1); continue; } // Check collision with player if (player.intersects(obstacle)) { LK.effects.flashScreen(0xff0000, 1000); LK.getSound('danger').play(); LK.showGameOver(); return; } } // Clean up projectiles for (var j = projectiles.length - 1; j >= 0; j--) { var projectile = projectiles[j]; // Remove expired or off-screen projectiles if (projectile.lifetime <= 0 || projectile.x < -50 || projectile.x > 2098 || projectile.y < -50 || projectile.y > 2782) { projectile.destroy(); projectiles.splice(j, 1); continue; } // Check collision with player if (player.intersects(projectile)) { LK.effects.flashScreen(0xff0000, 1000); LK.getSound('danger').play(); LK.showGameOver(); return; } } // Clean up danger zones for (var k = dangerZones.length - 1; k >= 0; k--) { var zone = dangerZones[k]; // Remove fully expanded zones if (!zone.expanding && zone.currentSize >= zone.maxSize) { zone.destroy(); dangerZones.splice(k, 1); continue; } // Check collision with player (only when zone is large enough) if (zone.currentSize > 100 && player.intersects(zone)) { LK.effects.flashScreen(0xff0000, 1000); LK.getSound('danger').play(); LK.showGameOver(); return; } } // Calculate score based on survival time and proximity to danger var proximityBonus = 0; for (var m = 0; m < obstacles.length; m++) { var dist = Math.sqrt(Math.pow(player.x - obstacles[m].x, 2) + Math.pow(player.y - obstacles[m].y, 2)); if (dist < 150) { proximityBonus += Math.floor((150 - dist) / 10); } } var currentScore = survivalTime * 10 + proximityBonus; LK.setScore(currentScore); scoreTxt.setText(LK.getScore().toString()); timeTxt.setText(survivalTime + 's'); // Win condition (survive for 2 minutes) if (survivalTime >= 120) { LK.showYouWin(); } };
===================================================================
--- original.js
+++ change.js
@@ -20,20 +20,42 @@
if (self.expanding) {
self.currentSize += self.expandRate;
if (self.currentSize >= self.maxSize) {
self.expanding = false;
+ // Smooth transition to warning colors when fully expanded
+ tween(graphics, {
+ tint: 0xff0000,
+ alpha: 0.9
+ }, {
+ duration: 500,
+ easing: tween.easeInOut
+ });
}
}
var scale = self.currentSize / 200;
graphics.scaleX = scale;
graphics.scaleY = scale;
- // Beat pulse effect
+ // Beat pulse effect with smooth tweening
if (beatPulse > 0) {
- graphics.alpha = 0.8;
- graphics.tint = 0xffffff;
- } else {
- graphics.alpha = 0.4;
- graphics.tint = 0xff0080;
+ // Intense pulse on beat
+ tween(graphics, {
+ alpha: 1.0,
+ tint: 0xffffff
+ }, {
+ duration: 100,
+ easing: tween.easeOut
+ });
+ } else if (beatPulse === 0) {
+ // Return to base state
+ var baseAlpha = self.expanding ? 0.4 : 0.7;
+ var baseTint = self.expanding ? 0xff0080 : 0xff0000;
+ tween(graphics, {
+ alpha: baseAlpha,
+ tint: baseTint
+ }, {
+ duration: 300,
+ easing: tween.easeInOut
+ });
}
};
return self;
});
@@ -46,18 +68,34 @@
self.rotationSpeed = 0.02;
self.beatScale = 1;
self.update = function () {
graphics.rotation += self.rotationSpeed;
- // Beat synchronization
+ // Beat synchronization with smooth tweening
if (beatPulse > 0) {
- self.beatScale = 1 + beatPulse * 0.4;
- graphics.tint = 0xffffff;
- } else {
- self.beatScale = 1;
- graphics.tint = 0xff4444;
+ // Smooth scale animation on beat
+ tween(graphics, {
+ scaleX: 1.4,
+ scaleY: 1.4,
+ tint: 0xffffff
+ }, {
+ duration: 200,
+ easing: tween.easeOut
+ });
+ // Spin faster on beat
+ self.rotationSpeed = 0.05;
+ } else if (beatPulse === 0) {
+ // Return to normal scale
+ tween(graphics, {
+ scaleX: 1,
+ scaleY: 1,
+ tint: 0xff4444
+ }, {
+ duration: 300,
+ easing: tween.easeInOut
+ });
+ // Normal rotation speed
+ self.rotationSpeed = 0.02;
}
- graphics.scaleX = self.beatScale;
- graphics.scaleY = self.beatScale;
};
return self;
});
var ObstacleWall = Container.expand(function () {
@@ -69,19 +107,48 @@
self.moveSpeed = 3;
self.direction = 1; // 1 for right, -1 for left
self.update = function () {
self.x += self.moveSpeed * self.direction;
- // Beat pulse effect
+ // Beat pulse effect with smooth tweening
if (beatPulse > 0) {
- graphics.scaleY = 1 + beatPulse * 0.5;
- graphics.tint = 0xffffff;
- } else {
- graphics.scaleY = 1;
- graphics.tint = 0xff6666;
+ // Smooth scale and tint animation on beat
+ tween(graphics, {
+ scaleY: 1.5,
+ tint: 0xffffff
+ }, {
+ duration: 150,
+ easing: tween.easeOut
+ });
+ // Brief speed boost on beat
+ self.moveSpeed = 5;
+ } else if (beatPulse === 0) {
+ // Return to normal scale and tint
+ tween(graphics, {
+ scaleY: 1,
+ tint: 0xff6666
+ }, {
+ duration: 400,
+ easing: tween.easeInOut
+ });
+ // Normal speed
+ self.moveSpeed = 3;
}
- // Bounce off screen edges
+ // Bounce off screen edges with smooth direction change
if (self.x > 2048 - 150 || self.x < 150) {
self.direction *= -1;
+ // Add a brief flash when bouncing
+ tween(graphics, {
+ tint: 0xffff00
+ }, {
+ duration: 100,
+ onFinish: function onFinish() {
+ tween(graphics, {
+ tint: 0xff6666
+ }, {
+ duration: 200
+ });
+ }
+ });
}
};
return self;
});
@@ -99,16 +166,29 @@
var dx = self.targetX - self.x;
var dy = self.targetY - self.y;
self.x += dx * 0.15;
self.y += dy * 0.15;
- // Pulse effect on beat
+ // Pulse effect on beat with smooth tweening
if (beatPulse > 0) {
- var scale = 1 + beatPulse * 0.3;
- playerGraphics.scaleX = scale;
- playerGraphics.scaleY = scale;
- } else {
- playerGraphics.scaleX = 1;
- playerGraphics.scaleY = 1;
+ // Energetic pulse on beat
+ tween(playerGraphics, {
+ scaleX: 1.3,
+ scaleY: 1.3,
+ tint: 0xffffff
+ }, {
+ duration: 100,
+ easing: tween.easeOut
+ });
+ } else if (beatPulse === 0) {
+ // Return to normal state
+ tween(playerGraphics, {
+ scaleX: 1,
+ scaleY: 1,
+ tint: 0x00ff88
+ }, {
+ duration: 200,
+ easing: tween.easeInOut
+ });
}
};
return self;
});
@@ -124,16 +204,45 @@
self.update = function () {
self.x += self.velocityX;
self.y += self.velocityY;
self.lifetime--;
- // Beat pulse
+ // Beat pulse with smooth tweening
if (beatPulse > 0) {
- graphics.scaleX = 1.5;
- graphics.scaleY = 1.5;
- } else {
- graphics.scaleX = 1;
- graphics.scaleY = 1;
+ // Dramatic scale and color change on beat
+ tween(graphics, {
+ scaleX: 2,
+ scaleY: 2,
+ tint: 0xffffff
+ }, {
+ duration: 150,
+ easing: tween.easeOut
+ });
+ } else if (beatPulse === 0) {
+ // Return to normal state
+ tween(graphics, {
+ scaleX: 1,
+ scaleY: 1,
+ tint: 0xffaa00
+ }, {
+ duration: 250,
+ easing: tween.easeInOut
+ });
}
+ // Warning effect when lifetime is low
+ if (self.lifetime < 60 && self.lifetime % 10 === 0) {
+ tween(graphics, {
+ tint: 0xff0000
+ }, {
+ duration: 100,
+ onFinish: function onFinish() {
+ tween(graphics, {
+ tint: 0xffaa00
+ }, {
+ duration: 100
+ });
+ }
+ });
+ }
};
return self;
});
@@ -201,16 +310,39 @@
function spawnSpinner() {
var spinner = new ObstacleSpinner();
spinner.x = Math.random() * (2048 - 240) + 120;
spinner.y = Math.random() * (2732 - 240) + 120;
+ // Entrance animation
+ spinner.alpha = 0;
+ spinner.scaleX = 0.3;
+ spinner.scaleY = 0.3;
+ tween(spinner, {
+ alpha: 1,
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 400,
+ easing: tween.easeOut
+ });
obstacles.push(spinner);
game.addChild(spinner);
}
function spawnWall() {
var wall = new ObstacleWall();
wall.x = Math.random() > 0.5 ? 150 : 1898;
wall.y = Math.random() * (2732 - 300) + 150;
wall.direction = wall.x < 1024 ? 1 : -1;
+ // Entrance animation - slide in from edge
+ var originalX = wall.x;
+ wall.x = wall.direction === 1 ? -300 : 2348;
+ wall.alpha = 0.5;
+ tween(wall, {
+ x: originalX,
+ alpha: 1
+ }, {
+ duration: 600,
+ easing: tween.easeOut
+ });
obstacles.push(wall);
game.addChild(wall);
}
function spawnProjectile() {
@@ -252,8 +384,31 @@
function spawnDangerZone() {
var zone = new DangerZone();
zone.x = Math.random() * (2048 - 400) + 200;
zone.y = Math.random() * (2732 - 400) + 200;
+ // Entrance animation - fade in with warning pulse
+ zone.alpha = 0;
+ tween(zone, {
+ alpha: 0.4
+ }, {
+ duration: 300,
+ easing: tween.easeIn
+ });
+ // Warning pulse sequence
+ LK.setTimeout(function () {
+ tween(zone, {
+ alpha: 0.8
+ }, {
+ duration: 200
+ });
+ }, 100);
+ LK.setTimeout(function () {
+ tween(zone, {
+ alpha: 0.4
+ }, {
+ duration: 200
+ });
+ }, 300);
dangerZones.push(zone);
game.addChild(zone);
}
// Start music
Sawblade with blue inside. No background. Transparent background. Blank background. No shadows. 3d. In-Game asset. flat
Bomb. No background. Transparent background. Blank background. No shadows. 3d. In-Game asset. flat
Explosion. No background. Transparent background. Blank background. No shadows. 3d. In-Game asset. flat
Pink and green enemy. No background. Transparent background. Blank background. No shadows. 3d. In-Game asset. flat