User prompt
Karakteri takip eden "helehele" yerine "insta: oguzhandgzl" yaz
User prompt
Karakteri takip eden "helehele" yazısı olsun.
User prompt
Alt kısma " helehele" yaz
User prompt
Sağ alt köşeye ufak boyutlarda "insta: oguzhandgzl" yazısını ekle ve oyun başlangıcından bitişine kadar sabit kalsın.
User prompt
Sağ alt köşeye küçük boyutlarda "insta @oguzhandgzl" yazısını ekle
User prompt
Sağ alt köşeye "insta @oguzhandgzl" yazısını ekle
User prompt
Arka planda devamlı çalması için "Troll" adlı müziği ekle
User prompt
Can 0 olunca objelerin hareketi dursun
User prompt
Can sıfıra inince bekleme süresini 3 sn yap
User prompt
Can 0 olunca arka planda çıkan görsel "GameOver" olsun
User prompt
Can 0 olunca arka planda çıkan görsel karakterin görseli olsun
User prompt
Please fix the bug: 'TypeError: LK.effects.fadeScreen is not a function' in or related to this line: 'LK.effects.fadeScreen(0x000000, 1200, function () {' Line Number: 317
User prompt
Karakterim canı sıfır olunca oyun duraksasin "TrollGameOver" sesi çalsın, ekran yavaşça sönsün ve oyun bunlar olduktan sonra bitsin.
User prompt
Oyun baslayinca para değerini sıfır olsun
User prompt
Oyun bitince "TrollGameOver" adlı sesi oynat
User prompt
Karakter obstacle ile temas edince patlama sesi çıksın
User prompt
Karakter bomba ile temas edince ses çıkmasın
User prompt
Karakterim bomba ile temas edince patlama sesi çıksın
User prompt
Karakter bomba ile temas edince "Ahh" adlı ses oynasın
User prompt
Karakter bomba ile temas edince "Ahh" adlı ses oynasın
User prompt
Karakter kalp ile temas edince "ohh" adlı sesi oynatsin
User prompt
Karakter coin ile temas edince "Meterial" adlı sesi oynat
User prompt
Obje hızları rastgele olsun ama Max hızı çok fazla olmasın
User prompt
Kalbe temas ettiğimizde, bombaya temas edince oluşan efektin yeşil olanını ekle
User prompt
Tüm sesleri kaldırmanı istiyorum
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// Bomb collectible class
var BombCollectible = Container.expand(function () {
var self = Container.call(this);
var bombAsset = self.attachAsset('obstacle', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 0;
self.update = function () {
self.y += self.speed;
};
return self;
});
// Heart collectible class
var HeartCollectible = Container.expand(function () {
var self = Container.call(this);
var heartAsset = self.attachAsset('Heart', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 0;
self.update = function () {
self.y += self.speed;
};
return self;
});
// Obstacle class
var Obstacle = Container.expand(function () {
var self = Container.call(this);
var obsAsset = self.attachAsset('obstacle', {
anchorX: 0.5,
anchorY: 0.5
});
// Speed will be set on creation
self.speed = 0;
self.update = function () {
self.y += self.speed;
};
return self;
});
// Point collectible class
var PointCollectible = Container.expand(function () {
var self = Container.call(this);
var pointAsset = self.attachAsset('point', {
anchorX: 0.5,
anchorY: 0.5
});
// Speed will be set on creation
self.speed = 0;
self.update = function () {
self.y += self.speed;
};
return self;
});
// Runner class
var Runner = Container.expand(function () {
var self = Container.call(this);
var runnerAsset = self.attachAsset('runner', {
anchorX: 0.5,
anchorY: 0.5
});
// For swipe movement
self.targetX = self.x;
self.targetY = self.y;
// For collision flash
self.flash = function () {
tween(self, {
alpha: 0.3
}, {
duration: 80,
onFinish: function onFinish() {
tween(self, {
alpha: 1
}, {
duration: 120
});
}
});
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x888888
});
/****
* Game Code
****/
// Game area dimensions
// Runner character: a colorful box
// Obstacle: a red ellipse
// Point collectible: a yellow box
// Play 'Troll' music in a loop as background music
var GAME_WIDTH = 2048;
var GAME_HEIGHT = 2732;
// Runner start position
var runnerStartX = GAME_WIDTH / 2;
var runnerStartY = GAME_HEIGHT - 400;
// Create runner
var runner = new Runner();
runner.x = runnerStartX;
runner.y = runnerStartY;
runner.targetX = runner.x;
runner.targetY = runner.y;
game.addChild(runner);
// Score
var score = 0;
var scoreTxt = new Text2('0', {
size: 120,
fill: 0x222222
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Lives and Money
var lives = 3;
var livesMoneyTxt = new Text2('♥ ' + lives + ' $' + money, {
size: 100,
fill: 0xff3b30
});
livesMoneyTxt.anchor.set(0, 0);
livesMoneyTxt.x = 120;
livesMoneyTxt.y = 40;
LK.gui.top.addChild(livesMoneyTxt);
// Arrays for obstacles and points
var obstacles = [];
var points = [];
var hearts = [];
var bombs = [];
var money = 0;
// Difficulty progression
var baseSpeed = 14;
var speedIncrease = 0.012; // per tick
var spawnInterval = 60; // ticks between spawns
var minSpawnInterval = 24;
var tickCount = 0;
// Swipe handling
var swipeStartX = null;
var swipeStartY = null;
var isSwiping = false;
// Helper: clamp value
function clamp(val, min, max) {
return Math.max(min, Math.min(max, val));
}
// Touch/drag events for swipe
game.down = function (x, y, obj) {
// Only start swipe if touch is not in top left 100x100
if (x < 100 && y < 100) return;
swipeStartX = x;
swipeStartY = y;
runnerStartX = runner.x; // Save runner's current X as the base for delta
isSwiping = true;
};
game.move = function (x, y, obj) {
// Only move runner if swipe is active
if (isSwiping && swipeStartX !== null) {
// Move runner by the same delta as finger movement
var deltaX = x - swipeStartX;
var newX = clamp(runnerStartX + deltaX, 100 + runner.width / 2, GAME_WIDTH - runner.width / 2 - 100);
runner.x = newX;
runner.y = runnerStartY;
}
};
game.up = function (x, y, obj) {
isSwiping = false;
swipeStartX = null;
swipeStartY = null;
// Optionally, snap runner back to base Y
tween(runner, {
y: runnerStartY
}, {
duration: 180,
easing: tween.cubicOut
});
};
// Main game update loop
game.update = function () {
tickCount++;
// Increase speed over time
var currentSpeed = baseSpeed + speedIncrease * tickCount;
// Spawn obstacles, points, hearts, and bombs
if (tickCount % spawnInterval === 0) {
// Helper to get random speed in range [min, max]
var getRandomSpeed = function getRandomSpeed(min, max) {
return min + Math.random() * (max - min);
};
// Randomly decide: obstacle, point, heart, or bomb
// 60% obstacle, 25% point, 8% heart, 7% bomb
var rand = Math.random();
var spawnType = 'obstacle';
if (rand < 0.6) spawnType = 'obstacle';else if (rand < 0.85) spawnType = 'point';else if (rand < 0.93) spawnType = 'heart';else spawnType = 'bomb';
var laneCount = 5;
var laneWidth = (GAME_WIDTH - 400) / laneCount;
var lane = Math.floor(Math.random() * laneCount);
var spawnX = 200 + laneWidth / 2 + lane * laneWidth;
var spawnY = -120;
// Set max speed for each type
var maxObstacleSpeed = 28;
var maxCollectibleSpeed = 18;
if (spawnType === 'obstacle') {
var obs = new Obstacle();
obs.x = spawnX;
obs.y = spawnY;
// Randomize speed, but cap at maxObstacleSpeed
var minObsSpeed = Math.max(currentSpeed * 0.7, 8);
var maxObsSpeed = Math.min(currentSpeed * 1.1, maxObstacleSpeed);
obs.speed = getRandomSpeed(minObsSpeed, maxObsSpeed);
obstacles.push(obs);
game.addChild(obs);
} else if (spawnType === 'point') {
var pt = new PointCollectible();
pt.x = spawnX;
pt.y = spawnY;
// Randomize speed, but cap at maxCollectibleSpeed
var minPtSpeed = Math.max(currentSpeed * 0.35, 5);
var maxPtSpeed = Math.min(currentSpeed * 0.65, maxCollectibleSpeed);
pt.speed = getRandomSpeed(minPtSpeed, maxPtSpeed);
points.push(pt);
game.addChild(pt);
} else if (spawnType === 'heart') {
var heart = new HeartCollectible();
heart.x = spawnX;
heart.y = spawnY;
// Randomize speed, but cap at maxCollectibleSpeed
var minHeartSpeed = Math.max(currentSpeed * 0.35, 5);
var maxHeartSpeed = Math.min(currentSpeed * 0.65, maxCollectibleSpeed);
heart.speed = getRandomSpeed(minHeartSpeed, maxHeartSpeed);
hearts.push(heart);
game.addChild(heart);
} else if (spawnType === 'bomb') {
var bomb = new BombCollectible();
bomb.x = spawnX;
bomb.y = spawnY;
// Randomize speed, but cap at maxCollectibleSpeed
var minBombSpeed = Math.max(currentSpeed * 0.35, 5);
var maxBombSpeed = Math.min(currentSpeed * 0.65, maxCollectibleSpeed);
bomb.speed = getRandomSpeed(minBombSpeed, maxBombSpeed);
bombs.push(bomb);
game.addChild(bomb);
}
// Gradually decrease spawn interval to increase difficulty
if (spawnInterval > minSpawnInterval && tickCount % 600 === 0) {
spawnInterval -= 4;
if (spawnInterval < minSpawnInterval) spawnInterval = minSpawnInterval;
}
}
// Update obstacles
for (var i = obstacles.length - 1; i >= 0; i--) {
var obs = obstacles[i];
obs.update();
// Remove if off screen
if (obs.y - obs.height / 2 > GAME_HEIGHT + 100) {
obs.destroy();
obstacles.splice(i, 1);
continue;
}
// Collision with runner
if (obs.intersects(runner)) {
// Play explosion sound
LK.getSound('Explosion').play();
// Flash runner
runner.flash();
// Flash screen
LK.effects.flashScreen(0xff3b30, 600);
// Decrease lives
lives -= 1;
if (lives < 0) lives = 0;
livesMoneyTxt.setText('♥ ' + lives + ' $' + money);
// Remove obstacle so it doesn't hit again
obs.destroy();
obstacles.splice(i, 1);
// Game over if no lives left
if (lives <= 0) {
LK.showGameOver();
return;
}
continue;
}
}
// Update points
for (var j = points.length - 1; j >= 0; j--) {
var pt = points[j];
pt.update();
// Remove if off screen
if (pt.y - pt.height / 2 > GAME_HEIGHT + 100) {
pt.destroy();
points.splice(j, 1);
continue;
}
// Collectible collision
if (pt.intersects(runner)) {
// Play coin collect sound
LK.getSound('Meterial').play();
// Add score and money
score += 1;
money += 1;
LK.setScore(score);
scoreTxt.setText(score);
livesMoneyTxt.setText('♥ ' + lives + ' $' + money);
// Flash screen yellow, similar to bomb's effect (darker, longer, more solid)
LK.effects.flashScreen(0xffc800, 600);
pt.destroy();
points.splice(j, 1);
continue;
}
}
// Update hearts
for (var h = hearts.length - 1; h >= 0; h--) {
var heart = hearts[h];
heart.update();
// Remove if off screen
if (heart.y - heart.height / 2 > GAME_HEIGHT + 100) {
heart.destroy();
hearts.splice(h, 1);
continue;
}
// Collectible collision
if (heart.intersects(runner)) {
// Play 'ohh' sound
LK.getSound('ohh').play();
// Add life
lives += 1;
livesMoneyTxt.setText('♥ ' + lives + ' $' + money);
// Flash screen green, similar to bomb's effect but green
LK.effects.flashScreen(0x00ff00, 600);
// No runner tint flash on heart collect; runner always stays default color
heart.destroy();
hearts.splice(h, 1);
continue;
}
}
// Update bombs
for (var b = bombs.length - 1; b >= 0; b--) {
var bomb = bombs[b];
bomb.update();
// Remove if off screen
if (bomb.y - bomb.height / 2 > GAME_HEIGHT + 100) {
bomb.destroy();
bombs.splice(b, 1);
continue;
}
// Bomb collision
if (bomb.intersects(runner)) {
// Lose a life
lives -= 1;
if (lives < 0) lives = 0;
livesMoneyTxt.setText('♥ ' + lives + ' $' + money);
// No runner tint flash on bomb collect; runner always stays default color
LK.effects.flashScreen(0x222222, 600);
bomb.destroy();
bombs.splice(b, 1);
// Game over if no lives left
if (lives <= 0) {
LK.showGameOver();
return;
}
continue;
}
}
};
// Center score text at top, avoid top left 100x100
scoreTxt.x = 1024;
scoreTxt.y = 40; ===================================================================
--- original.js
+++ change.js
@@ -266,8 +266,10 @@
continue;
}
// Collision with runner
if (obs.intersects(runner)) {
+ // Play explosion sound
+ LK.getSound('Explosion').play();
// Flash runner
runner.flash();
// Flash screen
LK.effects.flashScreen(0xff3b30, 600);