User prompt
Gold toplama, iksir toplama, yanma ve kazanma sesleri ekle
User prompt
Arkaplana uzun bir müzik ekle
User prompt
Altınları toplarken yuvarlak ve koyu sarı bir parlama yap.
User prompt
Please fix the bug: 'TypeError: LK.effects.glowObject is not a function' in or related to this line: 'LK.effects.glowObject(g, 0xffb300, 1.0, 80, 0.7); // color, strength, radius, alpha' Line Number: 567
User prompt
Altınları toplarken koyu sarı ve büyuk glow parlama ver.
User prompt
Gold ları küçük yap
User prompt
Gold glow koyu sarı renge ve büyük olmaya zorla ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Daha büyük yap
User prompt
Gold glow sarı renke zorla ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Altınları toplarken sarı glow parlama ver sarı renkte ve büyük çapta olsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Gold glow sarı renk yap
User prompt
Sarı renkte olsun
User prompt
Altınları toplarken glow parlama ver sarı renkte ve büyük çapta olsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Altınları toplarken glow efekti ver sarı renkte ve büyük çapta olsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Gold toplarken sarı renkte parlama efekti ekle
User prompt
Halı 2 kat büyüt
User prompt
Bulutlar daha dağınık olsu
User prompt
Bulutlar arkaplan da büyük ve kücüjk rastgele dağılsın
User prompt
Eksik. assetleri ekle
User prompt
Oyuncuyu 2 kat büyüt
User prompt
Joystik gözükmüyor
User prompt
Dağ assetini tekrar ekle
User prompt
Oyuncu hemen dokunduğum yerde olmasın
User prompt
Oyungu kontrolünü dokunmatik yap
User prompt
Oyuncu kontrolü sorunlu.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Enemy var Enemy = Container.expand(function () { var self = Container.call(this); var enemy = self.attachAsset('enemy', { anchorX: 0.5, anchorY: 0.5 }); self.width = enemy.width; self.height = enemy.height; self.speed = 4 + Math.random() * 2; self.update = function () { self.x -= self.speed; }; return self; }); // Exit Door var ExitDoor = Container.expand(function () { var self = Container.call(this); var exit = self.attachAsset('exit', { anchorX: 0.5, anchorY: 1 }); self.width = exit.width; self.height = exit.height; return self; }); // Gold var Gold = Container.expand(function () { var self = Container.call(this); var gold = self.attachAsset('gold', { anchorX: 0.5, anchorY: 0.5 }); self.width = gold.width; self.height = gold.height; self.collected = false; return self; }); // Joystick var Joystick = Container.expand(function () { var self = Container.call(this); // Large, glassy, transparent base var base = self.attachAsset('joystickBase', { anchorX: 0.5, anchorY: 0.5, alpha: 0.18 // More glassy, less visible }); // Large knob, more visible var knob = self.attachAsset('joystickKnob', { anchorX: 0.5, anchorY: 0.5, alpha: 0.7 }); self.baseRadius = base.width / 2; self.knobRadius = knob.width / 2; self.knob = knob; // --- Big Arrow Overlays --- // Arrow style: white, semi-transparent, large, pointing outwards function createArrow(rotation) { // Use a box as arrow body, and a triangle as arrow head (simulate with two ellipses for sandbox) var arrow = new Container(); // Arrow body (rectangle) var body = LK.getAsset('joystickKnob', { width: 38, height: 90, color: 0xffffff, anchorX: 0.5, anchorY: 0.8, alpha: 0.18 }); // Arrow head (ellipse, simulates triangle tip) var head = LK.getAsset('joystickKnob', { width: 70, height: 70, color: 0xffffff, anchorX: 0.5, anchorY: 0.2, alpha: 0.32 }); body.y = 0; head.y = -50; arrow.addChild(body); arrow.addChild(head); arrow.rotation = rotation; return arrow; } // Up var arrowUp = createArrow(0); arrowUp.y = -base.width * 0.36; self.addChild(arrowUp); // Down var arrowDown = createArrow(Math.PI); arrowDown.y = base.width * 0.36; self.addChild(arrowDown); // Left var arrowLeft = createArrow(-Math.PI / 2); arrowLeft.x = -base.width * 0.36; self.addChild(arrowLeft); // Right var arrowRight = createArrow(Math.PI / 2); arrowRight.x = base.width * 0.36; self.addChild(arrowRight); // Place knob on top self.addChild(knob); self.active = false; self.touchId = null; self.centerX = 0; self.centerY = 0; self.valueX = 0; self.valueY = 0; self.reset = function () { self.knob.x = 0; self.knob.y = 0; self.valueX = 0; self.valueY = 0; }; self.down = function (x, y, obj) { self.active = true; self.centerX = self.x; self.centerY = self.y; self.touchId = obj.event && obj.event.identifier !== undefined ? obj.event.identifier : null; self.move(x, y, obj); }; self.move = function (x, y, obj) { if (!self.active) return; var dx = x - self.centerX; var dy = y - self.centerY; var dist = Math.sqrt(dx * dx + dy * dy); var maxDist = self.baseRadius - self.knobRadius; if (dist > maxDist) { dx = dx * maxDist / dist; dy = dy * maxDist / dist; dist = maxDist; } self.knob.x = dx; self.knob.y = dy; self.valueX = dx / maxDist; self.valueY = dy / maxDist; }; self.up = function (x, y, obj) { self.active = false; self.touchId = null; self.reset(); }; self.reset(); return self; }); // MagicCarpet: Player var MagicCarpet = Container.expand(function () { var self = Container.call(this); var carpet = self.attachAsset('carpet', { anchorX: 0.5, anchorY: 0.5 }); self.width = carpet.width; self.height = carpet.height; self.baseY = 0; self.swayTick = 0; self.update = function () { // Sway up and down self.swayTick += 0.07; self.y = self.baseY + Math.sin(self.swayTick) * 18; }; return self; }); // ParallaxLayer: For background movement var ParallaxLayer = Container.expand(function () { var self = Container.call(this); self.speed = 0; self.sprites = []; self.assetId = ''; self.y = 0; self.height = 0; self.init = function (assetId, y, speed, count) { self.assetId = assetId; self.y = y; self.speed = speed; self.height = LK.getAsset(assetId, {}).height; for (var i = 0; i < count; i++) { var sprite = self.attachAsset(assetId, { anchorX: 0, anchorY: 0, x: i * LK.getAsset(assetId, {}).width, y: 0 }); self.sprites.push(sprite); } }; self.update = function () { for (var i = 0; i < self.sprites.length; i++) { var s = self.sprites[i]; s.x -= self.speed; if (s.x <= -s.width) { // Move to right s.x += s.width * self.sprites.length; } } }; return self; }); // Potion var Potion = Container.expand(function () { var self = Container.call(this); var potion = self.attachAsset('potion', { anchorX: 0.5, anchorY: 0.5 }); self.width = potion.width; self.height = potion.height; self.collected = false; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87ceeb // Sky blue }); /**** * Game Code ****/ // --- Parallax Layers --- // Sihirli Halı (Magic Carpet) // Altın (Gold) // İksir (Potion) // Düşman (Enemy) // Çıkış Kapısı (Exit Door) // Zemin (Ground, parallax layer 1) // Dağlar (Mountains, parallax layer 2) // Bulut (Cloud, parallax layer 3) // Joystick tabanı // Joystick topu var parallaxLayers = []; // Layer 1: Ground (closest) var groundLayer = new ParallaxLayer(); groundLayer.init('ground', 2732 - 300, 2.5, 2); game.addChild(groundLayer); parallaxLayers.push(groundLayer); // Layer 2: Mountains (middle) var mountainLayer = new ParallaxLayer(); mountainLayer.init('mountain', 2732 - 300 - 180, 1.2, 2); game.addChild(mountainLayer); parallaxLayers.push(mountainLayer); // Layer 3: Clouds (farthest) var cloudLayer = new ParallaxLayer(); cloudLayer.init('cloud', 400, 0.5, 4); game.addChild(cloudLayer); parallaxLayers.push(cloudLayer); // --- Exit Door --- var exitDoor = new ExitDoor(); exitDoor.x = 2048 - 200; exitDoor.y = 2732 - 300 - 10; exitDoor.visible = false; game.addChild(exitDoor); // --- Magic Carpet (Player) --- var carpet = new MagicCarpet(); carpet.x = 320; carpet.baseY = 2732 / 2; carpet.y = carpet.baseY; game.addChild(carpet); // --- Collectibles --- var golds = []; var potions = []; // Gold positions (spread out, not overlapping, not too close to edges) var goldPositions = [{ x: 700, y: 700 }, { x: 1200, y: 900 }, { x: 900, y: 1700 }, { x: 1500, y: 1200 }, { x: 1800, y: 2100 }]; for (var i = 0; i < 5; i++) { var g = new Gold(); g.x = goldPositions[i].x; g.y = goldPositions[i].y; golds.push(g); game.addChild(g); } // Potion positions var potionPositions = [{ x: 1100, y: 2200 }, { x: 1700, y: 600 }]; for (var i = 0; i < 2; i++) { var p = new Potion(); p.x = potionPositions[i].x; p.y = potionPositions[i].y; potions.push(p); game.addChild(p); } // --- Enemies --- var enemies = []; function spawnEnemies() { // 3 enemies, random vertical positions, spaced horizontally enemies.length = 0; for (var i = 0; i < 3; i++) { var e = new Enemy(); e.x = 2048 + 200 + i * 300; e.y = 600 + Math.random() * (2732 - 1200); enemies.push(e); game.addChild(e); } } spawnEnemies(); // --- Joystick --- var joystick = new Joystick(); // Center bottom: x = 2048/2, y = just above bottom edge, accounting for joystick size joystick.x = 2048 / 2; joystick.y = 2732 - joystick.baseRadius - 40; // 40px margin from bottom // Always remove joystick from any parent before adding to LK.gui.bottom if (joystick.parent && joystick.parent.removeChild) { joystick.parent.removeChild(joystick); } LK.gui.bottom.addChild(joystick); // --- GUI: Score/Progress --- var progressTxt = new Text2('', { size: 80, fill: "#fff" }); progressTxt.anchor.set(0.5, 0); LK.gui.top.addChild(progressTxt); // --- State --- var collectedGold = 0; var collectedPotion = 0; var allCollected = false; var gameOver = false; var youWin = false; // --- Helper: Update Progress Text --- function updateProgressText() { progressTxt.setText("Altın: " + collectedGold + "/5 İksir: " + collectedPotion + "/2"); } updateProgressText(); // --- Helper: Reset Game State --- function resetGame() { // Reset collectibles for (var i = 0; i < golds.length; i++) { golds[i].collected = false; golds[i].visible = true; } for (var i = 0; i < potions.length; i++) { potions[i].collected = false; potions[i].visible = true; } collectedGold = 0; collectedPotion = 0; allCollected = false; updateProgressText(); // Reset player carpet.x = 320; carpet.baseY = 2732 / 2; carpet.swayTick = 0; // Reset enemies for (var i = 0; i < enemies.length; i++) { enemies[i].destroy(); } spawnEnemies(); // Hide exit exitDoor.visible = false; gameOver = false; youWin = false; } // --- Joystick Event Handling --- // (Handled by Joystick class itself) // --- Touch Handling for Joystick (on GUI) --- LK.gui.bottom.down = function (x, y, obj) { // Only trigger if inside joystick area var localX = x - joystick.x; var localY = y - joystick.y; if (localX * localX + localY * localY <= joystick.baseRadius * joystick.baseRadius) { joystick.down(x, y, obj); } }; LK.gui.bottom.move = function (x, y, obj) { if (joystick.active) { joystick.move(x, y, obj); } }; LK.gui.bottom.up = function (x, y, obj) { if (joystick.active) { joystick.up(x, y, obj); } }; // --- Main Game Move Handler (for mobile drag outside joystick) --- // (No handler needed; joystick handles movement) // --- Main Game Update Loop --- game.update = function () { if (gameOver || youWin) return; // Parallax layers for (var i = 0; i < parallaxLayers.length; i++) { parallaxLayers[i].update(); } // Player movement (joystick) var speed = 13; var vx = joystick.valueX * speed; var vy = joystick.valueY * speed; carpet.x += vx; carpet.baseY += vy; // Clamp inside play area (not too close to edges) var margin = 60; if (carpet.x < margin + carpet.width / 2) carpet.x = margin + carpet.width / 2; if (carpet.x > 2048 - margin - carpet.width / 2) carpet.x = 2048 - margin - carpet.width / 2; if (carpet.baseY < margin + carpet.height / 2) carpet.baseY = margin + carpet.height / 2; if (carpet.baseY > 2732 - 300 - margin - carpet.height / 2) carpet.baseY = 2732 - 300 - margin - carpet.height / 2; // Sway carpet.update(); // Collectibles: Gold for (var i = 0; i < golds.length; i++) { var g = golds[i]; if (!g.collected && carpet.intersects(g)) { g.collected = true; g.visible = false; collectedGold++; updateProgressText(); } } // Collectibles: Potion for (var i = 0; i < potions.length; i++) { var p = potions[i]; if (!p.collected && carpet.intersects(p)) { p.collected = true; p.visible = false; collectedPotion++; updateProgressText(); } } // All collected? if (!allCollected && collectedGold === 5 && collectedPotion === 2) { allCollected = true; // Show exit door exitDoor.visible = true; // Animate door (flash green) tween(exitDoor, { tint: 0x00ff00 }, { duration: 600, easing: tween.bounceOut }); } // Enemies for (var i = 0; i < enemies.length; i++) { var e = enemies[i]; e.update(); // If off screen left, respawn to right if (e.x < -e.width) { e.x = 2048 + 200 + Math.random() * 200; e.y = 600 + Math.random() * (2732 - 1200); e.speed = 4 + Math.random() * 2; } // Collision with player if (carpet.intersects(e)) { // Game over gameOver = true; LK.effects.flashScreen(0xff0000, 900); LK.setTimeout(function () { LK.showGameOver(); }, 900); return; } } // Win condition: All collected and reached exit if (allCollected && carpet.intersects(exitDoor)) { youWin = true; LK.effects.flashScreen(0x00ff00, 700); LK.setTimeout(function () { LK.showYouWin(); }, 700); return; } }; // --- Game Over/Win Reset Handler --- LK.on('gameover', function () { resetGame(); }); LK.on('youwin', function () { resetGame(); });
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// Enemy
var Enemy = Container.expand(function () {
var self = Container.call(this);
var enemy = self.attachAsset('enemy', {
anchorX: 0.5,
anchorY: 0.5
});
self.width = enemy.width;
self.height = enemy.height;
self.speed = 4 + Math.random() * 2;
self.update = function () {
self.x -= self.speed;
};
return self;
});
// Exit Door
var ExitDoor = Container.expand(function () {
var self = Container.call(this);
var exit = self.attachAsset('exit', {
anchorX: 0.5,
anchorY: 1
});
self.width = exit.width;
self.height = exit.height;
return self;
});
// Gold
var Gold = Container.expand(function () {
var self = Container.call(this);
var gold = self.attachAsset('gold', {
anchorX: 0.5,
anchorY: 0.5
});
self.width = gold.width;
self.height = gold.height;
self.collected = false;
return self;
});
// Joystick
var Joystick = Container.expand(function () {
var self = Container.call(this);
// Large, glassy, transparent base
var base = self.attachAsset('joystickBase', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.18 // More glassy, less visible
});
// Large knob, more visible
var knob = self.attachAsset('joystickKnob', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.7
});
self.baseRadius = base.width / 2;
self.knobRadius = knob.width / 2;
self.knob = knob;
// --- Big Arrow Overlays ---
// Arrow style: white, semi-transparent, large, pointing outwards
function createArrow(rotation) {
// Use a box as arrow body, and a triangle as arrow head (simulate with two ellipses for sandbox)
var arrow = new Container();
// Arrow body (rectangle)
var body = LK.getAsset('joystickKnob', {
width: 38,
height: 90,
color: 0xffffff,
anchorX: 0.5,
anchorY: 0.8,
alpha: 0.18
});
// Arrow head (ellipse, simulates triangle tip)
var head = LK.getAsset('joystickKnob', {
width: 70,
height: 70,
color: 0xffffff,
anchorX: 0.5,
anchorY: 0.2,
alpha: 0.32
});
body.y = 0;
head.y = -50;
arrow.addChild(body);
arrow.addChild(head);
arrow.rotation = rotation;
return arrow;
}
// Up
var arrowUp = createArrow(0);
arrowUp.y = -base.width * 0.36;
self.addChild(arrowUp);
// Down
var arrowDown = createArrow(Math.PI);
arrowDown.y = base.width * 0.36;
self.addChild(arrowDown);
// Left
var arrowLeft = createArrow(-Math.PI / 2);
arrowLeft.x = -base.width * 0.36;
self.addChild(arrowLeft);
// Right
var arrowRight = createArrow(Math.PI / 2);
arrowRight.x = base.width * 0.36;
self.addChild(arrowRight);
// Place knob on top
self.addChild(knob);
self.active = false;
self.touchId = null;
self.centerX = 0;
self.centerY = 0;
self.valueX = 0;
self.valueY = 0;
self.reset = function () {
self.knob.x = 0;
self.knob.y = 0;
self.valueX = 0;
self.valueY = 0;
};
self.down = function (x, y, obj) {
self.active = true;
self.centerX = self.x;
self.centerY = self.y;
self.touchId = obj.event && obj.event.identifier !== undefined ? obj.event.identifier : null;
self.move(x, y, obj);
};
self.move = function (x, y, obj) {
if (!self.active) return;
var dx = x - self.centerX;
var dy = y - self.centerY;
var dist = Math.sqrt(dx * dx + dy * dy);
var maxDist = self.baseRadius - self.knobRadius;
if (dist > maxDist) {
dx = dx * maxDist / dist;
dy = dy * maxDist / dist;
dist = maxDist;
}
self.knob.x = dx;
self.knob.y = dy;
self.valueX = dx / maxDist;
self.valueY = dy / maxDist;
};
self.up = function (x, y, obj) {
self.active = false;
self.touchId = null;
self.reset();
};
self.reset();
return self;
});
// MagicCarpet: Player
var MagicCarpet = Container.expand(function () {
var self = Container.call(this);
var carpet = self.attachAsset('carpet', {
anchorX: 0.5,
anchorY: 0.5
});
self.width = carpet.width;
self.height = carpet.height;
self.baseY = 0;
self.swayTick = 0;
self.update = function () {
// Sway up and down
self.swayTick += 0.07;
self.y = self.baseY + Math.sin(self.swayTick) * 18;
};
return self;
});
// ParallaxLayer: For background movement
var ParallaxLayer = Container.expand(function () {
var self = Container.call(this);
self.speed = 0;
self.sprites = [];
self.assetId = '';
self.y = 0;
self.height = 0;
self.init = function (assetId, y, speed, count) {
self.assetId = assetId;
self.y = y;
self.speed = speed;
self.height = LK.getAsset(assetId, {}).height;
for (var i = 0; i < count; i++) {
var sprite = self.attachAsset(assetId, {
anchorX: 0,
anchorY: 0,
x: i * LK.getAsset(assetId, {}).width,
y: 0
});
self.sprites.push(sprite);
}
};
self.update = function () {
for (var i = 0; i < self.sprites.length; i++) {
var s = self.sprites[i];
s.x -= self.speed;
if (s.x <= -s.width) {
// Move to right
s.x += s.width * self.sprites.length;
}
}
};
return self;
});
// Potion
var Potion = Container.expand(function () {
var self = Container.call(this);
var potion = self.attachAsset('potion', {
anchorX: 0.5,
anchorY: 0.5
});
self.width = potion.width;
self.height = potion.height;
self.collected = false;
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87ceeb // Sky blue
});
/****
* Game Code
****/
// --- Parallax Layers ---
// Sihirli Halı (Magic Carpet)
// Altın (Gold)
// İksir (Potion)
// Düşman (Enemy)
// Çıkış Kapısı (Exit Door)
// Zemin (Ground, parallax layer 1)
// Dağlar (Mountains, parallax layer 2)
// Bulut (Cloud, parallax layer 3)
// Joystick tabanı
// Joystick topu
var parallaxLayers = [];
// Layer 1: Ground (closest)
var groundLayer = new ParallaxLayer();
groundLayer.init('ground', 2732 - 300, 2.5, 2);
game.addChild(groundLayer);
parallaxLayers.push(groundLayer);
// Layer 2: Mountains (middle)
var mountainLayer = new ParallaxLayer();
mountainLayer.init('mountain', 2732 - 300 - 180, 1.2, 2);
game.addChild(mountainLayer);
parallaxLayers.push(mountainLayer);
// Layer 3: Clouds (farthest)
var cloudLayer = new ParallaxLayer();
cloudLayer.init('cloud', 400, 0.5, 4);
game.addChild(cloudLayer);
parallaxLayers.push(cloudLayer);
// --- Exit Door ---
var exitDoor = new ExitDoor();
exitDoor.x = 2048 - 200;
exitDoor.y = 2732 - 300 - 10;
exitDoor.visible = false;
game.addChild(exitDoor);
// --- Magic Carpet (Player) ---
var carpet = new MagicCarpet();
carpet.x = 320;
carpet.baseY = 2732 / 2;
carpet.y = carpet.baseY;
game.addChild(carpet);
// --- Collectibles ---
var golds = [];
var potions = [];
// Gold positions (spread out, not overlapping, not too close to edges)
var goldPositions = [{
x: 700,
y: 700
}, {
x: 1200,
y: 900
}, {
x: 900,
y: 1700
}, {
x: 1500,
y: 1200
}, {
x: 1800,
y: 2100
}];
for (var i = 0; i < 5; i++) {
var g = new Gold();
g.x = goldPositions[i].x;
g.y = goldPositions[i].y;
golds.push(g);
game.addChild(g);
}
// Potion positions
var potionPositions = [{
x: 1100,
y: 2200
}, {
x: 1700,
y: 600
}];
for (var i = 0; i < 2; i++) {
var p = new Potion();
p.x = potionPositions[i].x;
p.y = potionPositions[i].y;
potions.push(p);
game.addChild(p);
}
// --- Enemies ---
var enemies = [];
function spawnEnemies() {
// 3 enemies, random vertical positions, spaced horizontally
enemies.length = 0;
for (var i = 0; i < 3; i++) {
var e = new Enemy();
e.x = 2048 + 200 + i * 300;
e.y = 600 + Math.random() * (2732 - 1200);
enemies.push(e);
game.addChild(e);
}
}
spawnEnemies();
// --- Joystick ---
var joystick = new Joystick();
// Center bottom: x = 2048/2, y = just above bottom edge, accounting for joystick size
joystick.x = 2048 / 2;
joystick.y = 2732 - joystick.baseRadius - 40; // 40px margin from bottom
// Always remove joystick from any parent before adding to LK.gui.bottom
if (joystick.parent && joystick.parent.removeChild) {
joystick.parent.removeChild(joystick);
}
LK.gui.bottom.addChild(joystick);
// --- GUI: Score/Progress ---
var progressTxt = new Text2('', {
size: 80,
fill: "#fff"
});
progressTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(progressTxt);
// --- State ---
var collectedGold = 0;
var collectedPotion = 0;
var allCollected = false;
var gameOver = false;
var youWin = false;
// --- Helper: Update Progress Text ---
function updateProgressText() {
progressTxt.setText("Altın: " + collectedGold + "/5 İksir: " + collectedPotion + "/2");
}
updateProgressText();
// --- Helper: Reset Game State ---
function resetGame() {
// Reset collectibles
for (var i = 0; i < golds.length; i++) {
golds[i].collected = false;
golds[i].visible = true;
}
for (var i = 0; i < potions.length; i++) {
potions[i].collected = false;
potions[i].visible = true;
}
collectedGold = 0;
collectedPotion = 0;
allCollected = false;
updateProgressText();
// Reset player
carpet.x = 320;
carpet.baseY = 2732 / 2;
carpet.swayTick = 0;
// Reset enemies
for (var i = 0; i < enemies.length; i++) {
enemies[i].destroy();
}
spawnEnemies();
// Hide exit
exitDoor.visible = false;
gameOver = false;
youWin = false;
}
// --- Joystick Event Handling ---
// (Handled by Joystick class itself)
// --- Touch Handling for Joystick (on GUI) ---
LK.gui.bottom.down = function (x, y, obj) {
// Only trigger if inside joystick area
var localX = x - joystick.x;
var localY = y - joystick.y;
if (localX * localX + localY * localY <= joystick.baseRadius * joystick.baseRadius) {
joystick.down(x, y, obj);
}
};
LK.gui.bottom.move = function (x, y, obj) {
if (joystick.active) {
joystick.move(x, y, obj);
}
};
LK.gui.bottom.up = function (x, y, obj) {
if (joystick.active) {
joystick.up(x, y, obj);
}
};
// --- Main Game Move Handler (for mobile drag outside joystick) ---
// (No handler needed; joystick handles movement)
// --- Main Game Update Loop ---
game.update = function () {
if (gameOver || youWin) return;
// Parallax layers
for (var i = 0; i < parallaxLayers.length; i++) {
parallaxLayers[i].update();
}
// Player movement (joystick)
var speed = 13;
var vx = joystick.valueX * speed;
var vy = joystick.valueY * speed;
carpet.x += vx;
carpet.baseY += vy;
// Clamp inside play area (not too close to edges)
var margin = 60;
if (carpet.x < margin + carpet.width / 2) carpet.x = margin + carpet.width / 2;
if (carpet.x > 2048 - margin - carpet.width / 2) carpet.x = 2048 - margin - carpet.width / 2;
if (carpet.baseY < margin + carpet.height / 2) carpet.baseY = margin + carpet.height / 2;
if (carpet.baseY > 2732 - 300 - margin - carpet.height / 2) carpet.baseY = 2732 - 300 - margin - carpet.height / 2;
// Sway
carpet.update();
// Collectibles: Gold
for (var i = 0; i < golds.length; i++) {
var g = golds[i];
if (!g.collected && carpet.intersects(g)) {
g.collected = true;
g.visible = false;
collectedGold++;
updateProgressText();
}
}
// Collectibles: Potion
for (var i = 0; i < potions.length; i++) {
var p = potions[i];
if (!p.collected && carpet.intersects(p)) {
p.collected = true;
p.visible = false;
collectedPotion++;
updateProgressText();
}
}
// All collected?
if (!allCollected && collectedGold === 5 && collectedPotion === 2) {
allCollected = true;
// Show exit door
exitDoor.visible = true;
// Animate door (flash green)
tween(exitDoor, {
tint: 0x00ff00
}, {
duration: 600,
easing: tween.bounceOut
});
}
// Enemies
for (var i = 0; i < enemies.length; i++) {
var e = enemies[i];
e.update();
// If off screen left, respawn to right
if (e.x < -e.width) {
e.x = 2048 + 200 + Math.random() * 200;
e.y = 600 + Math.random() * (2732 - 1200);
e.speed = 4 + Math.random() * 2;
}
// Collision with player
if (carpet.intersects(e)) {
// Game over
gameOver = true;
LK.effects.flashScreen(0xff0000, 900);
LK.setTimeout(function () {
LK.showGameOver();
}, 900);
return;
}
}
// Win condition: All collected and reached exit
if (allCollected && carpet.intersects(exitDoor)) {
youWin = true;
LK.effects.flashScreen(0x00ff00, 700);
LK.setTimeout(function () {
LK.showYouWin();
}, 700);
return;
}
};
// --- Game Over/Win Reset Handler ---
LK.on('gameover', function () {
resetGame();
});
LK.on('youwin', function () {
resetGame();
});
Fullscreen modern App Store landscape banner, 16:9, high definition, for a game titled "Sihirli Halı: Çöl Macerası" and with the description "Sihirli halı ile çöl manzarasında süzül, altın ve iksirleri topla, düşmanlardan kaç ve çıkış kapısına ulaş!". No text on banner!
Pofuduk yumuşacık bulut. In-Game asset. 2d. High contrast. No shadows
sihirli iksir mavi renk. In-Game asset. 2d. High contrast. No shadows
red angry bird transparan. In-Game asset. 2d. High contrast. No shadows
Green wood arabic door. In-Game asset. 2d. High contrast. No shadows
Gold coin up view tranparent. In-Game asset. 2d. High contrast. No shadows no text