/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var FallingItem = Container.expand(function (itemType) {
var self = Container.call(this);
self.itemType = itemType || 'common';
self.fallSpeed = 5.4553125 * 1.5;
var assetName = 'commonItem';
self.points = 15;
if (self.itemType === 'rare') {
assetName = 'rareItem';
self.points = 75;
} else if (self.itemType === 'bomb') {
assetName = 'bomb';
self.points = 0;
}
var itemGraphics = self.attachAsset(assetName, {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
self.y += self.fallSpeed;
};
return self;
});
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 1.0
});
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x4A90E2
});
/****
* Game Code
****/
var player = game.addChild(new Player());
player.x = 2048 / 2;
player.y = 2732 - 50;
var fallingItems = [];
var dragNode = null;
var gameSpeed = 1;
var itemSpawnRate = 29; // Reduced by 50% from 58 to increase spawn rate
var scoreTxt = new Text2('0', {
size: 100,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
scoreTxt.y = 100;
// Start relaxing background music
LK.playMusic('bgmusic');
// Create background flying objects
var backgroundObjects = [];
function createBird() {
var bird = new Text2('🐦', {
size: 60,
fill: 0x8B4513
});
bird.x = -100;
bird.y = Math.random() * 1000 + 200;
bird.anchor.set(0.5, 0.5);
backgroundObjects.push({
object: bird,
type: 'bird',
speed: 1 + Math.random() * 2
});
game.addChild(bird);
}
function createCloud() {
var cloud = new Text2('☁️', {
size: 80 + Math.random() * 40,
fill: 0xFFFFFF
});
cloud.x = -150;
cloud.y = Math.random() * 800 + 100;
cloud.anchor.set(0.5, 0.5);
cloud.alpha = 0.7 + Math.random() * 0.3;
backgroundObjects.push({
object: cloud,
type: 'cloud',
speed: 0.3 + Math.random() * 0.7
});
game.addChild(cloud);
}
// Initial background objects
createBird();
createCloud();
// Create sun/moon object
var celestialBody = new Text2('☀️', {
size: 120,
fill: 0xFFD700
});
celestialBody.x = 200;
celestialBody.y = 150;
celestialBody.anchor.set(0.5, 0.5);
celestialBody.isDay = true;
game.addChild(celestialBody);
function spawnItem() {
var itemType = 'common';
var rand = Math.random();
if (rand < 0.25) {
itemType = 'bomb';
} else if (rand < 0.35) {
itemType = 'rare';
}
var newItem = new FallingItem(itemType);
// Spread items across entire width with better distribution
newItem.x = Math.random() * 2048;
newItem.y = -50 - Math.random() * 100; // Vary starting Y position for better spread
newItem.fallSpeed = (5.4553125 + gameSpeed * 0.5) * 1.5;
newItem.lastY = newItem.y;
newItem.lastIntersecting = false;
fallingItems.push(newItem);
game.addChild(newItem);
}
function handleMove(x, y, obj) {
player.x = x;
if (player.x < 60) player.x = 60;
if (player.x > 2048 - 60) player.x = 2048 - 60;
}
game.move = handleMove;
game.down = function (x, y, obj) {
handleMove(x, y, obj);
};
game.up = function (x, y, obj) {};
game.update = function () {
// Set background color based on day/night cycle
if (celestialBody.isDay) {
// Bright blue sky during day
game.setBackgroundColor(0x87CEEB);
} else {
// Dark night sky
game.setBackgroundColor(0x191970);
}
// Spawn items
if (LK.ticks % Math.max(30, itemSpawnRate - Math.floor(gameSpeed * 10)) == 0) {
spawnItem();
}
// Increase game speed gradually
if (LK.ticks % 600 == 0) {
gameSpeed += 0.2;
}
// Update celestial body (sun/moon transition)
var dayDuration = 1800; // 30 seconds at 60fps
var timePhase = LK.ticks % dayDuration / dayDuration;
if (timePhase < 0.5 && !celestialBody.isDay) {
// Transition to day
celestialBody.setText('☀️');
celestialBody.tint = 0xFFD700;
celestialBody.isDay = true;
tween(celestialBody, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 1000,
easing: tween.easeInOut
});
} else if (timePhase >= 0.5 && celestialBody.isDay) {
// Transition to night
celestialBody.setText('🌙');
celestialBody.tint = 0xC0C0C0;
celestialBody.isDay = false;
tween(celestialBody, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 1000,
easing: tween.easeInOut
});
}
// Update background objects
for (var j = backgroundObjects.length - 1; j >= 0; j--) {
var bgObj = backgroundObjects[j];
if (bgObj.type === 'bird') {
bgObj.object.x += bgObj.speed;
// Add slight vertical movement for birds
bgObj.object.y += Math.sin(LK.ticks * 0.02 + j) * 0.5;
// Check collision with falling items - birds die when hit
for (var k = fallingItems.length - 1; k >= 0; k--) {
var item = fallingItems[k];
if (bgObj.object.intersects(item)) {
// Bird death effect
tween(bgObj.object, {
scaleX: 0.1,
scaleY: 0.1,
alpha: 0,
rotation: Math.PI * 2
}, {
duration: 800,
easing: tween.easeOut
});
// Flash effect for bird death
LK.effects.flashObject(bgObj.object, 0xFF0000, 500);
// Remove bird after effect
LK.setTimeout(function () {
if (bgObj.object.parent) {
bgObj.object.destroy();
}
}, 800);
backgroundObjects.splice(j, 1);
item.destroy();
fallingItems.splice(k, 1);
break; // Exit item loop since bird is destroyed
}
}
if (bgObj.object.x > 2148) {
bgObj.object.destroy();
backgroundObjects.splice(j, 1);
}
} else if (bgObj.type === 'cloud') {
bgObj.object.x += bgObj.speed;
// Add gentle floating movement for clouds
bgObj.object.y += Math.sin(LK.ticks * 0.01 + j) * 0.3;
if (bgObj.object.x > 2248) {
bgObj.object.destroy();
backgroundObjects.splice(j, 1);
}
}
}
// Spawn new background objects occasionally
if (LK.ticks % 300 == 0 && Math.random() < 0.7) {
createBird();
}
if (LK.ticks % 450 == 0 && Math.random() < 0.5) {
createCloud();
}
// Update falling items
for (var i = fallingItems.length - 1; i >= 0; i--) {
var item = fallingItems[i];
if (item.lastY === undefined) item.lastY = item.y;
if (item.lastIntersecting === undefined) item.lastIntersecting = false;
// Remove items that fall off screen
if (item.lastY < 2732 + 100 && item.y >= 2732 + 100) {
item.destroy();
fallingItems.splice(i, 1);
continue;
}
// Check collision with player
var currentIntersecting = item.intersects(player);
if (!item.lastIntersecting && currentIntersecting) {
if (item.itemType === 'bomb') {
// Create explosion effect by scaling the bomb before destroying it
tween(item, {
scaleX: 3,
scaleY: 3,
alpha: 0
}, {
duration: 300,
easing: tween.easeOut,
onFinish: function onFinish() {
// Item will be destroyed below anyway
}
});
LK.setScore(0);
LK.effects.flashScreen(0xFF0000, 500);
LK.getSound('explosion').play();
} else {
LK.setScore(LK.getScore() + item.points);
if (item.itemType === 'rare') {
LK.effects.flashObject(player, 0xFFD700, 300);
LK.getSound('rare').play();
} else {
LK.getSound('itemCollect').play();
}
}
scoreTxt.setText(LK.getScore());
item.destroy();
fallingItems.splice(i, 1);
continue;
}
item.lastY = item.y;
item.lastIntersecting = currentIntersecting;
}
}; /****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var FallingItem = Container.expand(function (itemType) {
var self = Container.call(this);
self.itemType = itemType || 'common';
self.fallSpeed = 5.4553125 * 1.5;
var assetName = 'commonItem';
self.points = 15;
if (self.itemType === 'rare') {
assetName = 'rareItem';
self.points = 75;
} else if (self.itemType === 'bomb') {
assetName = 'bomb';
self.points = 0;
}
var itemGraphics = self.attachAsset(assetName, {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
self.y += self.fallSpeed;
};
return self;
});
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 1.0
});
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x4A90E2
});
/****
* Game Code
****/
var player = game.addChild(new Player());
player.x = 2048 / 2;
player.y = 2732 - 50;
var fallingItems = [];
var dragNode = null;
var gameSpeed = 1;
var itemSpawnRate = 29; // Reduced by 50% from 58 to increase spawn rate
var scoreTxt = new Text2('0', {
size: 100,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
scoreTxt.y = 100;
// Start relaxing background music
LK.playMusic('bgmusic');
// Create background flying objects
var backgroundObjects = [];
function createBird() {
var bird = new Text2('🐦', {
size: 60,
fill: 0x8B4513
});
bird.x = -100;
bird.y = Math.random() * 1000 + 200;
bird.anchor.set(0.5, 0.5);
backgroundObjects.push({
object: bird,
type: 'bird',
speed: 1 + Math.random() * 2
});
game.addChild(bird);
}
function createCloud() {
var cloud = new Text2('☁️', {
size: 80 + Math.random() * 40,
fill: 0xFFFFFF
});
cloud.x = -150;
cloud.y = Math.random() * 800 + 100;
cloud.anchor.set(0.5, 0.5);
cloud.alpha = 0.7 + Math.random() * 0.3;
backgroundObjects.push({
object: cloud,
type: 'cloud',
speed: 0.3 + Math.random() * 0.7
});
game.addChild(cloud);
}
// Initial background objects
createBird();
createCloud();
// Create sun/moon object
var celestialBody = new Text2('☀️', {
size: 120,
fill: 0xFFD700
});
celestialBody.x = 200;
celestialBody.y = 150;
celestialBody.anchor.set(0.5, 0.5);
celestialBody.isDay = true;
game.addChild(celestialBody);
function spawnItem() {
var itemType = 'common';
var rand = Math.random();
if (rand < 0.25) {
itemType = 'bomb';
} else if (rand < 0.35) {
itemType = 'rare';
}
var newItem = new FallingItem(itemType);
// Spread items across entire width with better distribution
newItem.x = Math.random() * 2048;
newItem.y = -50 - Math.random() * 100; // Vary starting Y position for better spread
newItem.fallSpeed = (5.4553125 + gameSpeed * 0.5) * 1.5;
newItem.lastY = newItem.y;
newItem.lastIntersecting = false;
fallingItems.push(newItem);
game.addChild(newItem);
}
function handleMove(x, y, obj) {
player.x = x;
if (player.x < 60) player.x = 60;
if (player.x > 2048 - 60) player.x = 2048 - 60;
}
game.move = handleMove;
game.down = function (x, y, obj) {
handleMove(x, y, obj);
};
game.up = function (x, y, obj) {};
game.update = function () {
// Set background color based on day/night cycle
if (celestialBody.isDay) {
// Bright blue sky during day
game.setBackgroundColor(0x87CEEB);
} else {
// Dark night sky
game.setBackgroundColor(0x191970);
}
// Spawn items
if (LK.ticks % Math.max(30, itemSpawnRate - Math.floor(gameSpeed * 10)) == 0) {
spawnItem();
}
// Increase game speed gradually
if (LK.ticks % 600 == 0) {
gameSpeed += 0.2;
}
// Update celestial body (sun/moon transition)
var dayDuration = 1800; // 30 seconds at 60fps
var timePhase = LK.ticks % dayDuration / dayDuration;
if (timePhase < 0.5 && !celestialBody.isDay) {
// Transition to day
celestialBody.setText('☀️');
celestialBody.tint = 0xFFD700;
celestialBody.isDay = true;
tween(celestialBody, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 1000,
easing: tween.easeInOut
});
} else if (timePhase >= 0.5 && celestialBody.isDay) {
// Transition to night
celestialBody.setText('🌙');
celestialBody.tint = 0xC0C0C0;
celestialBody.isDay = false;
tween(celestialBody, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 1000,
easing: tween.easeInOut
});
}
// Update background objects
for (var j = backgroundObjects.length - 1; j >= 0; j--) {
var bgObj = backgroundObjects[j];
if (bgObj.type === 'bird') {
bgObj.object.x += bgObj.speed;
// Add slight vertical movement for birds
bgObj.object.y += Math.sin(LK.ticks * 0.02 + j) * 0.5;
// Check collision with falling items - birds die when hit
for (var k = fallingItems.length - 1; k >= 0; k--) {
var item = fallingItems[k];
if (bgObj.object.intersects(item)) {
// Bird death effect
tween(bgObj.object, {
scaleX: 0.1,
scaleY: 0.1,
alpha: 0,
rotation: Math.PI * 2
}, {
duration: 800,
easing: tween.easeOut
});
// Flash effect for bird death
LK.effects.flashObject(bgObj.object, 0xFF0000, 500);
// Remove bird after effect
LK.setTimeout(function () {
if (bgObj.object.parent) {
bgObj.object.destroy();
}
}, 800);
backgroundObjects.splice(j, 1);
item.destroy();
fallingItems.splice(k, 1);
break; // Exit item loop since bird is destroyed
}
}
if (bgObj.object.x > 2148) {
bgObj.object.destroy();
backgroundObjects.splice(j, 1);
}
} else if (bgObj.type === 'cloud') {
bgObj.object.x += bgObj.speed;
// Add gentle floating movement for clouds
bgObj.object.y += Math.sin(LK.ticks * 0.01 + j) * 0.3;
if (bgObj.object.x > 2248) {
bgObj.object.destroy();
backgroundObjects.splice(j, 1);
}
}
}
// Spawn new background objects occasionally
if (LK.ticks % 300 == 0 && Math.random() < 0.7) {
createBird();
}
if (LK.ticks % 450 == 0 && Math.random() < 0.5) {
createCloud();
}
// Update falling items
for (var i = fallingItems.length - 1; i >= 0; i--) {
var item = fallingItems[i];
if (item.lastY === undefined) item.lastY = item.y;
if (item.lastIntersecting === undefined) item.lastIntersecting = false;
// Remove items that fall off screen
if (item.lastY < 2732 + 100 && item.y >= 2732 + 100) {
item.destroy();
fallingItems.splice(i, 1);
continue;
}
// Check collision with player
var currentIntersecting = item.intersects(player);
if (!item.lastIntersecting && currentIntersecting) {
if (item.itemType === 'bomb') {
// Create explosion effect by scaling the bomb before destroying it
tween(item, {
scaleX: 3,
scaleY: 3,
alpha: 0
}, {
duration: 300,
easing: tween.easeOut,
onFinish: function onFinish() {
// Item will be destroyed below anyway
}
});
LK.setScore(0);
LK.effects.flashScreen(0xFF0000, 500);
LK.getSound('explosion').play();
} else {
LK.setScore(LK.getScore() + item.points);
if (item.itemType === 'rare') {
LK.effects.flashObject(player, 0xFFD700, 300);
LK.getSound('rare').play();
} else {
LK.getSound('itemCollect').play();
}
}
scoreTxt.setText(LK.getScore());
item.destroy();
fallingItems.splice(i, 1);
continue;
}
item.lastY = item.y;
item.lastIntersecting = currentIntersecting;
}
};
bomba. In-Game asset. 2d. High contrast. No shadows
gümüş yuvarlak top. In-Game asset. 2d. High contrast. No shadows
dikdörtgen bir biçimde ağzı açık karton kutu gerçekçi olsun. In-Game asset. 2d. High contrast. No shadows
altın külçe gerçekçi. In-Game asset. 2d. High contrast. No shadows