/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Bear = Container.expand(function () { var self = Container.call(this); var bearGraphics = self.attachAsset('bear', { anchorX: 0.5, anchorY: 0.5 }); return self; }); var HoneyJar = Container.expand(function () { var self = Container.call(this); var jarGraphics = self.attachAsset('honeyJar', { anchorX: 0.5, anchorY: 0.5 }); self.collected = false; self.fallSpeed = 3; self.floatOffset = Math.random() * Math.PI * 2; self.floatAmount = 1 + Math.random(); self.targetY = 2432; // Ground level where bear is positioned self.isFalling = false; // Start the gradual falling animation self.startFalling = function () { if (self.isFalling || self.collected) return; self.isFalling = true; // Calculate fall duration based on distance and speed var fallDistance = self.targetY - self.y; var fallDuration = fallDistance / self.fallSpeed * 16.67; // Convert to milliseconds (60fps) tween(self, { y: self.targetY }, { duration: fallDuration, easing: tween.linear, onFinish: function onFinish() { // Create explosion effect when hitting ground LK.effects.flashObject(self, 0xff4500, 500); // Orange flash for explosion // Animate explosion with scale tween(self, { scaleX: 2, scaleY: 2, alpha: 0 }, { duration: 500, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); } }); // Remove from honeyJars array for (var i = honeyJars.length - 1; i >= 0; i--) { if (honeyJars[i] === self) { honeyJars.splice(i, 1); break; } } } }); }; self.update = function () { if (self.collected) return; // Add gentle side-to-side floating like in a dream if (self.isFalling) { self.x += Math.sin(LK.ticks * 0.02 + self.floatOffset) * self.floatAmount; } // Remove jar if it falls off screen (backup cleanup) if (self.y > 2800) { for (var i = honeyJars.length - 1; i >= 0; i--) { if (honeyJars[i] === self) { honeyJars.splice(i, 1); break; } } self.destroy(); } }; self.collect = function () { if (self.collected) return; self.collected = true; // Stop falling animation tween.stop(self, { y: true }); // Animate collection with scale and fade tween(self, { scaleX: 0, scaleY: 0, alpha: 0 }, { duration: 300, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); } }); // Play collect sound LK.getSound('collect').play(); // Update score honeyCount += 1; LK.setScore(honeyCount); scoreTxt.setText(honeyCount + ' / 100'); // Check for victory if (honeyCount >= 100) { triggerHoneyDimension(); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0xE6E6FA // Dreamy lavender sky color }); /**** * Game Code ****/ var bear; var honeyJars = []; var honeyCount = 0; var dragNode = null; var spawnTimer = 0; var gameWon = false; var jarsSpawned = 0; var jarBatchSize = 5; // Reduced from 10 to 5 var batchSpawnInterval = 2000; // Increased from 1000ms to 2000ms for less frequent spawning // Create UI var scoreTxt = new Text2('0 / 100', { size: 80, fill: 0x8B4513 }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Create background var background = game.addChild(LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5 })); background.x = 1024; // Center horizontally background.y = 1366; // Center vertically // Create three ground segments to prevent distortion var ground1 = game.addChild(LK.getAsset('ground', { anchorX: 0.5, anchorY: 0 })); ground1.x = 341; // Left third (683/2) ground1.y = 2532; // Bottom of screen (2732 - 200) var ground2 = game.addChild(LK.getAsset('ground', { anchorX: 0.5, anchorY: 0 })); ground2.x = 1024; // Center third ground2.y = 2532; // Bottom of screen (2732 - 200) var ground3 = game.addChild(LK.getAsset('ground', { anchorX: 0.5, anchorY: 0 })); ground3.x = 1707; // Right third (2048 - 683/2) ground3.y = 2532; // Bottom of screen (2732 - 200) // Create bear bear = game.addChild(new Bear()); bear.x = 1024; // Center horizontally bear.y = 2432; // Higher up, at ground level for quadruple-sized bear function spawnHoneyJar() { var jar = new HoneyJar(); // Spawn from top of screen at random X position (adjusted for half-sized jars) jar.x = 50 + Math.random() * (2048 - 100); jar.y = -50; // Start above screen jar.fallSpeed = 3 + Math.random() * 4; // Random fall speed between 3-7 honeyJars.push(jar); game.addChild(jar); // Add gentle spawn animation jar.scaleX = 0.8; jar.scaleY = 0.8; tween(jar, { scaleX: 1, scaleY: 1 }, { duration: 300, easing: tween.easeOut, onFinish: function onFinish() { // Start falling animation after spawn animation completes jar.startFalling(); } }); } function triggerHoneyDimension() { if (gameWon) return; gameWon = true; // Play victory sound LK.getSound('victory').play(); // Create spectacular visual effects game.setBackgroundColor(0xFFD700); // Golden background // Flash effect LK.effects.flashScreen(0xFFFFFF, 1000); // Scale up bear for dramatic effect tween(bear, { scaleX: 2, scaleY: 2 }, { duration: 1500, easing: tween.easeInOut }); // Rotate bear tween(bear, { rotation: Math.PI * 4 }, { duration: 2000, easing: tween.easeInOut }); // Show victory after effects LK.setTimeout(function () { LK.showYouWin(); }, 2500); } function handleMove(x, y, obj) { if (dragNode && !gameWon) { dragNode.x = x; // Keep bear on ground - no vertical movement dragNode.y = 2432; // Keep bear within screen bounds horizontally only (adjusted for smaller bear) dragNode.x = Math.max(270, Math.min(1778, dragNode.x)); } } // Event handlers game.move = handleMove; game.down = function (x, y, obj) { if (!gameWon) { dragNode = bear; handleMove(x, y, obj); } }; game.up = function (x, y, obj) { dragNode = null; }; // Main game loop game.update = function () { if (gameWon) return; // No periodic spawning needed - all jars spawned at start // Check collisions between bear and honey jars for (var i = honeyJars.length - 1; i >= 0; i--) { var jar = honeyJars[i]; if (!jar.collected && bear.intersects(jar)) { jar.collect(); honeyJars.splice(i, 1); } } }; // Start the gradual spawning process function startGradualSpawning() { var _spawnBatch = function spawnBatch() { // Spawn current batch of jars for (var i = 0; i < jarBatchSize; i++) { // Add slight delay between jars in the same batch (function (index) { LK.setTimeout(function () { spawnHoneyJar(); jarsSpawned++; }, index * 200); // 200ms delay between each jar in batch })(i); } // Schedule next batch (unlimited spawning) LK.setTimeout(_spawnBatch, batchSpawnInterval); }; // Start the first batch _spawnBatch(); } // Start gradual spawning startGradualSpawning();
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Bear = Container.expand(function () {
var self = Container.call(this);
var bearGraphics = self.attachAsset('bear', {
anchorX: 0.5,
anchorY: 0.5
});
return self;
});
var HoneyJar = Container.expand(function () {
var self = Container.call(this);
var jarGraphics = self.attachAsset('honeyJar', {
anchorX: 0.5,
anchorY: 0.5
});
self.collected = false;
self.fallSpeed = 3;
self.floatOffset = Math.random() * Math.PI * 2;
self.floatAmount = 1 + Math.random();
self.targetY = 2432; // Ground level where bear is positioned
self.isFalling = false;
// Start the gradual falling animation
self.startFalling = function () {
if (self.isFalling || self.collected) return;
self.isFalling = true;
// Calculate fall duration based on distance and speed
var fallDistance = self.targetY - self.y;
var fallDuration = fallDistance / self.fallSpeed * 16.67; // Convert to milliseconds (60fps)
tween(self, {
y: self.targetY
}, {
duration: fallDuration,
easing: tween.linear,
onFinish: function onFinish() {
// Create explosion effect when hitting ground
LK.effects.flashObject(self, 0xff4500, 500); // Orange flash for explosion
// Animate explosion with scale
tween(self, {
scaleX: 2,
scaleY: 2,
alpha: 0
}, {
duration: 500,
easing: tween.easeOut,
onFinish: function onFinish() {
self.destroy();
}
});
// Remove from honeyJars array
for (var i = honeyJars.length - 1; i >= 0; i--) {
if (honeyJars[i] === self) {
honeyJars.splice(i, 1);
break;
}
}
}
});
};
self.update = function () {
if (self.collected) return;
// Add gentle side-to-side floating like in a dream
if (self.isFalling) {
self.x += Math.sin(LK.ticks * 0.02 + self.floatOffset) * self.floatAmount;
}
// Remove jar if it falls off screen (backup cleanup)
if (self.y > 2800) {
for (var i = honeyJars.length - 1; i >= 0; i--) {
if (honeyJars[i] === self) {
honeyJars.splice(i, 1);
break;
}
}
self.destroy();
}
};
self.collect = function () {
if (self.collected) return;
self.collected = true;
// Stop falling animation
tween.stop(self, {
y: true
});
// Animate collection with scale and fade
tween(self, {
scaleX: 0,
scaleY: 0,
alpha: 0
}, {
duration: 300,
easing: tween.easeOut,
onFinish: function onFinish() {
self.destroy();
}
});
// Play collect sound
LK.getSound('collect').play();
// Update score
honeyCount += 1;
LK.setScore(honeyCount);
scoreTxt.setText(honeyCount + ' / 100');
// Check for victory
if (honeyCount >= 100) {
triggerHoneyDimension();
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0xE6E6FA // Dreamy lavender sky color
});
/****
* Game Code
****/
var bear;
var honeyJars = [];
var honeyCount = 0;
var dragNode = null;
var spawnTimer = 0;
var gameWon = false;
var jarsSpawned = 0;
var jarBatchSize = 5; // Reduced from 10 to 5
var batchSpawnInterval = 2000; // Increased from 1000ms to 2000ms for less frequent spawning
// Create UI
var scoreTxt = new Text2('0 / 100', {
size: 80,
fill: 0x8B4513
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Create background
var background = game.addChild(LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5
}));
background.x = 1024; // Center horizontally
background.y = 1366; // Center vertically
// Create three ground segments to prevent distortion
var ground1 = game.addChild(LK.getAsset('ground', {
anchorX: 0.5,
anchorY: 0
}));
ground1.x = 341; // Left third (683/2)
ground1.y = 2532; // Bottom of screen (2732 - 200)
var ground2 = game.addChild(LK.getAsset('ground', {
anchorX: 0.5,
anchorY: 0
}));
ground2.x = 1024; // Center third
ground2.y = 2532; // Bottom of screen (2732 - 200)
var ground3 = game.addChild(LK.getAsset('ground', {
anchorX: 0.5,
anchorY: 0
}));
ground3.x = 1707; // Right third (2048 - 683/2)
ground3.y = 2532; // Bottom of screen (2732 - 200)
// Create bear
bear = game.addChild(new Bear());
bear.x = 1024; // Center horizontally
bear.y = 2432; // Higher up, at ground level for quadruple-sized bear
function spawnHoneyJar() {
var jar = new HoneyJar();
// Spawn from top of screen at random X position (adjusted for half-sized jars)
jar.x = 50 + Math.random() * (2048 - 100);
jar.y = -50; // Start above screen
jar.fallSpeed = 3 + Math.random() * 4; // Random fall speed between 3-7
honeyJars.push(jar);
game.addChild(jar);
// Add gentle spawn animation
jar.scaleX = 0.8;
jar.scaleY = 0.8;
tween(jar, {
scaleX: 1,
scaleY: 1
}, {
duration: 300,
easing: tween.easeOut,
onFinish: function onFinish() {
// Start falling animation after spawn animation completes
jar.startFalling();
}
});
}
function triggerHoneyDimension() {
if (gameWon) return;
gameWon = true;
// Play victory sound
LK.getSound('victory').play();
// Create spectacular visual effects
game.setBackgroundColor(0xFFD700); // Golden background
// Flash effect
LK.effects.flashScreen(0xFFFFFF, 1000);
// Scale up bear for dramatic effect
tween(bear, {
scaleX: 2,
scaleY: 2
}, {
duration: 1500,
easing: tween.easeInOut
});
// Rotate bear
tween(bear, {
rotation: Math.PI * 4
}, {
duration: 2000,
easing: tween.easeInOut
});
// Show victory after effects
LK.setTimeout(function () {
LK.showYouWin();
}, 2500);
}
function handleMove(x, y, obj) {
if (dragNode && !gameWon) {
dragNode.x = x;
// Keep bear on ground - no vertical movement
dragNode.y = 2432;
// Keep bear within screen bounds horizontally only (adjusted for smaller bear)
dragNode.x = Math.max(270, Math.min(1778, dragNode.x));
}
}
// Event handlers
game.move = handleMove;
game.down = function (x, y, obj) {
if (!gameWon) {
dragNode = bear;
handleMove(x, y, obj);
}
};
game.up = function (x, y, obj) {
dragNode = null;
};
// Main game loop
game.update = function () {
if (gameWon) return;
// No periodic spawning needed - all jars spawned at start
// Check collisions between bear and honey jars
for (var i = honeyJars.length - 1; i >= 0; i--) {
var jar = honeyJars[i];
if (!jar.collected && bear.intersects(jar)) {
jar.collect();
honeyJars.splice(i, 1);
}
}
};
// Start the gradual spawning process
function startGradualSpawning() {
var _spawnBatch = function spawnBatch() {
// Spawn current batch of jars
for (var i = 0; i < jarBatchSize; i++) {
// Add slight delay between jars in the same batch
(function (index) {
LK.setTimeout(function () {
spawnHoneyJar();
jarsSpawned++;
}, index * 200); // 200ms delay between each jar in batch
})(i);
}
// Schedule next batch (unlimited spawning)
LK.setTimeout(_spawnBatch, batchSpawnInterval);
};
// Start the first batch
_spawnBatch();
}
// Start gradual spawning
startGradualSpawning();
Tarro de miel con un poco de ella desbordandose. In-Game asset. 2d. High contrast. No shadows
Oso naranja de pelaje con pecho y osico amarillo, al igual que un nariz azul, quiero que tenga un poco de miel en su boca y que mire hacia arriba. In-Game asset. 2d. High contrast. No shadows
Cielo azul con un sol con lentes de sol. In-Game asset. 2d. High contrast. No shadows