User prompt
add three human asset as well
User prompt
score should written below of the distance. and score should be based on collecting of dream orbits. distance mention only distance no bonus for it. make the texts bold and snail effect ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
remove fall sound effect, instead of that add a sound effect for collecting moments of dream orbits
User prompt
remove background layer
User prompt
give snail a walking sound effect
User prompt
add background layer
User prompt
add dream orbits a transparent smooth glow. add them a fall sound effect. add snail a walking effect non stop. make ground longer to left ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
dream orbits should fall every time when they seen
User prompt
dream orbits should add bonus point to distance and make them more rare
User prompt
bonus dream orbs sometimes falling from sky, and if snail collect them it give bonus point to distance
User prompt
remove moon beam mechanics, dream mode. add dream orbs and when they are collected, give distance bonus points
User prompt
use dream orbs instead of human mechanic in dream mode, and when they are collected, give distance bonus points
User prompt
dreams orbs should be seen and when they are collected, give distance bonus points
User prompt
camera track continue in dream mode and goal is collecting dream orbs for bonus for distance
User prompt
in moon beam, sky should be purple. dream orbs should be ready for collecting but game should continue without humans
User prompt
try moon beam in the beginning phase
User prompt
max 3 human at the same time on the screen, no more
User prompt
fix it.
User prompt
make humans faster
User prompt
make it more less
User prompt
decrease %10 humans effect area
User prompt
remove score and put there distance. make humans bigger by x2. but humans spawn rate increase
User prompt
remove time limit for shell. and make humans more rare
User prompt
ground background should be infinite. humans should come to left
User prompt
camera should track snail. game should continue infinite to right. humans should be shown randomly and in less frequently
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var DreamOrb = Container.expand(function () {
var self = Container.call(this);
var orbGraphics = self.attachAsset('dreamOrb', {
anchorX: 0.5,
anchorY: 0.5
});
self.collected = false;
self.update = function () {
// All dream orbs fall downward
if (!self.fallSpeed) {
self.fallSpeed = 2 + Math.random() * 3; // Set random fall speed if not set
LK.getSound('fall').play(); // Play fall sound when starting to fall
}
self.y += self.fallSpeed;
// Add gentle horizontal drift while falling
self.x += Math.sin(LK.ticks * 0.03) * 0.5;
orbGraphics.rotation += 0.02;
// Transparent smooth glow effect
orbGraphics.alpha = 0.6 + Math.sin(LK.ticks * 0.05) * 0.4;
orbGraphics.tint = 0xFFFFFF;
// Pulse scaling for smooth glow attraction
var pulseScale = 1 + Math.sin(LK.ticks * 0.06) * 0.2;
orbGraphics.scaleX = pulseScale;
orbGraphics.scaleY = pulseScale;
};
return self;
});
var Human = Container.expand(function () {
var self = Container.call(this);
var humanTypes = ['human1', 'human2', 'human3'];
var randomType = humanTypes[Math.floor(Math.random() * humanTypes.length)];
var humanGraphics = self.attachAsset(randomType, {
anchorX: 0.5,
anchorY: 1,
scaleX: 1.8,
scaleY: 1.8
});
self.speed = 3;
self.update = function () {
// Humans move left relative to world
self.x -= self.speed;
};
// Add walking animation when human is created
self.startWalkingAnimation = function () {
// Create a subtle walking bob animation
tween(humanGraphics, {
y: humanGraphics.y - 10
}, {
duration: 800,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(humanGraphics, {
y: humanGraphics.y + 10
}, {
duration: 800,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (self.parent) {
// Only continue if human still exists
self.startWalkingAnimation();
}
}
});
}
});
// Add slight horizontal sway
tween(humanGraphics, {
rotation: 0.05
}, {
duration: 1200,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(humanGraphics, {
rotation: -0.05
}, {
duration: 1200,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (self.parent) {
// Only continue if human still exists
tween(humanGraphics, {
rotation: 0
}, {
duration: 600,
easing: tween.easeInOut
});
}
}
});
}
});
};
// Start the walking animation immediately
self.startWalkingAnimation();
return self;
});
var Snail = Container.expand(function () {
var self = Container.call(this);
var snailBody = self.attachAsset('snail', {
anchorX: 0.5,
anchorY: 1
});
var shell = self.attachAsset('shell', {
anchorX: 0.5,
anchorY: 1,
alpha: 0
});
self.isHidden = false;
self.speed = 2;
self.hide = function () {
if (!self.isHidden) {
self.isHidden = true;
snailBody.alpha = 0;
shell.alpha = 1;
hideTimer = 0; // Reset timer when hiding
LK.getSound('hide').play();
}
};
self.emerge = function () {
if (self.isHidden) {
self.isHidden = false;
snailBody.alpha = 1;
shell.alpha = 0;
hideTimer = 0; // Reset timer when emerging
}
};
// Start walking animation immediately
self.startWalkingAnimation = function () {
// Create subtle walking bob animation
tween(snailBody, {
y: snailBody.y - 8
}, {
duration: 600,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(snailBody, {
y: snailBody.y + 8
}, {
duration: 600,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (self.parent) {
self.startWalkingAnimation();
}
}
});
}
});
// Add slight shell bounce
tween(shell, {
y: shell.y - 5
}, {
duration: 800,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(shell, {
y: shell.y + 5
}, {
duration: 800,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (self.parent) {
// Continue shell animation
}
}
});
}
});
};
self.update = function () {
if (!self.isHidden) {
// Normal movement - snail moves right
self.x += self.speed;
distance += self.speed;
}
};
// Start walking animation immediately
self.startWalkingAnimation();
return self;
});
var Star = Container.expand(function () {
var self = Container.call(this);
var starGraphics = self.attachAsset('star', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Stars don't move - they stay in world position for parallax effect
starGraphics.alpha = 0.5 + Math.sin(LK.ticks * 0.05 + self.x * 0.01) * 0.5;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x191970
});
/****
* Game Code
****/
var snail;
var humans = [];
var dreamOrbs = [];
var stars = [];
var ground;
var backgrounds = [];
var scrollSpeed = 2;
var distance = 0;
var cameraX = 0;
var worldOffset = 0;
var isPressed = false;
var hideTimer = 0;
var maxHideTime = 180; // 3 seconds at 60fps
// UI
var distanceText = new Text2('Distance: 0m', {
size: 60,
fill: 0xFFFFFF
});
distanceText.anchor.set(0.5, 0);
LK.gui.top.addChild(distanceText);
// Create background array for infinite scrolling
var backgrounds = [];
// Create initial background segments - extend further to the left
for (var i = -3; i < 6; i++) {
var backgroundSegment = game.addChild(LK.getAsset('background', {
anchorX: 0,
anchorY: 0,
x: i * 2048,
y: 0
}));
backgrounds.push(backgroundSegment);
}
// Create ground array for infinite scrolling
var grounds = [];
// Create initial ground segments - extend further to the left
for (var i = -3; i < 6; i++) {
var groundSegment = game.addChild(LK.getAsset('ground', {
anchorX: 0,
anchorY: 1,
x: i * 2048,
y: 2732
}));
grounds.push(groundSegment);
}
// Create snail
snail = game.addChild(new Snail());
snail.x = 300;
snail.y = 2732 - 500; // Moved much higher above ground
// Create initial stars
for (var i = 0; i < 30; i++) {
var star = game.addChild(new Star());
star.x = Math.random() * 4096;
star.y = Math.random() * 1500;
stars.push(star);
}
function spawnHuman() {
var human = game.addChild(new Human());
human.x = cameraX + 2048 + Math.random() * 500; // Spawn from right side of screen
human.y = 2732 - 500; // Moved much higher above ground
humans.push(human);
}
function spawnDreamOrb() {
var orb = game.addChild(new DreamOrb());
// Spawn orbs ahead of snail in visible area
orb.x = snail.x + 800 + Math.random() * 1200; // Spawn ahead of snail
orb.y = Math.random() * 1500 + 300; // Upper portion of screen
dreamOrbs.push(orb);
}
function spawnFallingDreamOrb() {
var orb = game.addChild(new DreamOrb());
// Spawn from sky above visible area
orb.x = snail.x + (Math.random() - 0.5) * 2048; // Around snail position
orb.y = -100; // Start above screen
dreamOrbs.push(orb);
}
game.down = function (x, y, obj) {
isPressed = true;
snail.hide();
};
game.up = function (x, y, obj) {
isPressed = false;
snail.emerge();
};
game.update = function () {
// No hide timer - snail can stay hidden indefinitely
// Update distance display
distanceText.setText('Distance: ' + Math.floor(distance / 50) + 'm');
// Spawn dream orbs periodically
if (LK.ticks % 600 === 0 && dreamOrbs.length < 2) {
// Every 10 seconds, max 2 orbs
spawnDreamOrb();
}
// Sometimes spawn falling dream orbs from sky
if (Math.random() < 0.001) {
// Small chance each frame for bonus orbs
spawnFallingDreamOrb();
}
// Spawn humans more rarely, but increase rate with distance
var spawnRate = 0.0005 + Math.floor(distance / 50) * 0.0002; // Increase spawn rate every 50 distance units
if (humans.length < 3 && Math.random() < spawnRate) {
spawnHuman();
}
// Update and check humans
for (var i = humans.length - 1; i >= 0; i--) {
var human = humans[i];
// Check collision with snail
if (!snail.isHidden && snail.intersects(human)) {
LK.showGameOver();
return;
}
// Remove off-screen humans (behind camera)
if (human.x < cameraX - 500) {
// Stop any running animations before destroying
tween.stop(human.children[0]); // Stop animations on the human graphics
human.destroy();
humans.splice(i, 1);
}
}
// Update and check dream orbs
for (var i = dreamOrbs.length - 1; i >= 0; i--) {
var orb = dreamOrbs[i];
if (!orb.collected && snail.intersects(orb)) {
orb.collected = true;
LK.setScore(LK.getScore() + 10);
// Award bonus distance for collecting dream orbs
distance += 500; // Bonus distance for collecting dream orbs
LK.getSound('collect').play();
// Visual effect
tween(orb, {
alpha: 0,
scaleX: 2,
scaleY: 2
}, {
duration: 300,
onFinish: function onFinish() {
orb.destroy();
}
});
dreamOrbs.splice(i, 1);
} else if (orb.x < cameraX - 500 || orb.y > 2732 + 100) {
// Remove orbs that are too far behind camera or have fallen below ground
orb.destroy();
dreamOrbs.splice(i, 1);
}
}
// Camera tracking - follow snail
var targetCameraX = snail.x - 1024; // Keep snail in left-center of screen
cameraX += (targetCameraX - cameraX) * 0.1; // Smooth camera movement
// Update background with parallax scrolling (slower than game objects)
for (var i = 0; i < backgrounds.length; i++) {
backgrounds[i].x = backgrounds[i].x - cameraX * 0.3; // Slower parallax movement
}
// Update all game objects position relative to camera
game.x = -cameraX;
// Infinite world generation - add new stars ahead
if (LK.ticks % 300 === 0) {
var star = game.addChild(new Star());
star.x = snail.x + 2000 + Math.random() * 1000; // Spawn ahead of snail
star.y = Math.random() * 1500;
stars.push(star);
}
// Remove off-screen stars (behind camera)
for (var i = stars.length - 1; i >= 0; i--) {
if (stars[i].x < cameraX - 500) {
stars[i].destroy();
stars.splice(i, 1);
}
}
// Infinite background generation
var rightmostBackgroundX = -Infinity;
for (var i = 0; i < backgrounds.length; i++) {
if (backgrounds[i].x > rightmostBackgroundX) {
rightmostBackgroundX = backgrounds[i].x;
}
}
// Add new background segments ahead of camera
while (rightmostBackgroundX < cameraX + 4096) {
var newBackground = game.addChild(LK.getAsset('background', {
anchorX: 0,
anchorY: 0,
x: rightmostBackgroundX + 2048,
y: 0
}));
backgrounds.push(newBackground);
rightmostBackgroundX += 2048;
}
// Remove background segments behind camera
for (var i = backgrounds.length - 1; i >= 0; i--) {
if (backgrounds[i].x < cameraX - 2048) {
backgrounds[i].destroy();
backgrounds.splice(i, 1);
}
}
// Infinite ground generation
var rightmostGroundX = -Infinity;
for (var i = 0; i < grounds.length; i++) {
if (grounds[i].x > rightmostGroundX) {
rightmostGroundX = grounds[i].x;
}
}
// Add new ground segments ahead of camera
while (rightmostGroundX < cameraX + 4096) {
var newGround = game.addChild(LK.getAsset('ground', {
anchorX: 0,
anchorY: 1,
x: rightmostGroundX + 2048,
y: 2732
}));
grounds.push(newGround);
rightmostGroundX += 2048;
}
// Remove ground segments behind camera
for (var i = grounds.length - 1; i >= 0; i--) {
if (grounds[i].x < cameraX - 2048) {
grounds[i].destroy();
grounds.splice(i, 1);
}
}
// Distance is tracked automatically through snail movement
};
// Start background music
LK.playMusic('ambient'); ===================================================================
--- original.js
+++ change.js
@@ -213,8 +213,9 @@
var humans = [];
var dreamOrbs = [];
var stars = [];
var ground;
+var backgrounds = [];
var scrollSpeed = 2;
var distance = 0;
var cameraX = 0;
var worldOffset = 0;
@@ -227,8 +228,20 @@
fill: 0xFFFFFF
});
distanceText.anchor.set(0.5, 0);
LK.gui.top.addChild(distanceText);
+// Create background array for infinite scrolling
+var backgrounds = [];
+// Create initial background segments - extend further to the left
+for (var i = -3; i < 6; i++) {
+ var backgroundSegment = game.addChild(LK.getAsset('background', {
+ anchorX: 0,
+ anchorY: 0,
+ x: i * 2048,
+ y: 0
+ }));
+ backgrounds.push(backgroundSegment);
+}
// Create ground array for infinite scrolling
var grounds = [];
// Create initial ground segments - extend further to the left
for (var i = -3; i < 6; i++) {
@@ -343,8 +356,12 @@
}
// Camera tracking - follow snail
var targetCameraX = snail.x - 1024; // Keep snail in left-center of screen
cameraX += (targetCameraX - cameraX) * 0.1; // Smooth camera movement
+ // Update background with parallax scrolling (slower than game objects)
+ for (var i = 0; i < backgrounds.length; i++) {
+ backgrounds[i].x = backgrounds[i].x - cameraX * 0.3; // Slower parallax movement
+ }
// Update all game objects position relative to camera
game.x = -cameraX;
// Infinite world generation - add new stars ahead
if (LK.ticks % 300 === 0) {
@@ -359,8 +376,33 @@
stars[i].destroy();
stars.splice(i, 1);
}
}
+ // Infinite background generation
+ var rightmostBackgroundX = -Infinity;
+ for (var i = 0; i < backgrounds.length; i++) {
+ if (backgrounds[i].x > rightmostBackgroundX) {
+ rightmostBackgroundX = backgrounds[i].x;
+ }
+ }
+ // Add new background segments ahead of camera
+ while (rightmostBackgroundX < cameraX + 4096) {
+ var newBackground = game.addChild(LK.getAsset('background', {
+ anchorX: 0,
+ anchorY: 0,
+ x: rightmostBackgroundX + 2048,
+ y: 0
+ }));
+ backgrounds.push(newBackground);
+ rightmostBackgroundX += 2048;
+ }
+ // Remove background segments behind camera
+ for (var i = backgrounds.length - 1; i >= 0; i--) {
+ if (backgrounds[i].x < cameraX - 2048) {
+ backgrounds[i].destroy();
+ backgrounds.splice(i, 1);
+ }
+ }
// Infinite ground generation
var rightmostGroundX = -Infinity;
for (var i = 0; i < grounds.length; i++) {
if (grounds[i].x > rightmostGroundX) {
2048x100 pixel ground layer with grass. In-Game asset. 2d. High contrast. No shadows
white shiny little star 2d pixel art. In-Game asset. 2d. High contrast. No shadows
bad regular casual middle aged man full body 2d pixel art. In-Game asset. 2d. High contrast. No shadows
bad regular casual middle aged woman full body 2d pixel art. In-Game asset. 2d. High contrast. No shadows
bad regular casual kid full body 2d pixel art. In-Game asset. 2d. High contrast. No shadows
desperate depressive cute snail 2d pixel art. In-Game asset. 2d. High contrast. No shadows
dream orb 2d pixel art. In-Game asset. 2d. High contrast. No shadows
desperate depressive cute snail is hiding in shell 2d pixel art. In-Game asset. 2d. High contrast. No shadows
bad regular frown casual old woman full body 2d pixel art. In-Game asset. 2d. High contrast. No shadows
bad regular frown casual old man full body 2d pixel art. In-Game asset. 2d. High contrast. No shadows
bad regular frown casual girl kid blonde hair braided full body 2d pixel art. In-Game asset. 2d. High contrast. No shadows