User prompt
çizgileri kaldır sadece objenin tehlikeli olduğunu belli et ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
bir tehdit olduğunu belli edicek etrafına kırmızı çizgiler ekle ve dönmesin biraz daha uzunlamasına dursun ve paralar onunla aynı hizada olmasın
User prompt
aralarda rastgele engeller çıksın
User prompt
coin ekle
Remix started
Copy FlipFlap Bird
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Bird = Container.expand(function () { var self = Container.call(this); var birdGraphics = self.attachAsset('bird', { anchorX: 0.5, anchorY: 0.5 }); self.xSpeed = 10.9375; self.ySpeed = -20; self.gravity = 1; self.lift = -15; self.flap = function () { self.ySpeed = self.lift * 1.5; LK.getSound('flap').play(); }; self._update_migrated = function () { if (game.isMouseDown) { self.ySpeed += self.gravity / 3; } else { self.ySpeed += self.gravity; } self.y += self.ySpeed; self.x += self.xSpeed; if (self.y <= 0 || self.y >= 2732) { self.speed = -self.speed; } var targetRotation = Math.atan2(self.ySpeed, self.xSpeed * self.scale.x) / 2; birdGraphics.rotation += (targetRotation - birdGraphics.rotation) / 10; }; self.flip = function () { self.scale.x *= -1; }; }); var Coin = Container.expand(function () { var self = Container.call(this); var coinGraphics = self.attachAsset('coin', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; self.collected = false; self._move_migrated = function (speed) { self.y += speed; // Animate coin rotation coinGraphics.rotation += 0.1; }; return self; }); var Obstacle = Container.expand(function () { var self = Container.call(this); var obstacleShadow = self.attachAsset('obstacleShadow', { anchorX: 0.5, anchorY: 0.5 }); obstacleShadow.rotation = Math.PI / 4; var obstacleShadow2 = self.attachAsset('obstacleShadow2', { anchorX: 0.5, anchorY: 0.5 }); obstacleShadow2.rotation = Math.PI / 4; obstacleShadow2.y = -7; var obstacleGraphics = self.attachAsset('obstacle', { anchorX: 0.5, anchorY: 0.5 }); obstacleGraphics.rotation = Math.PI / 4; self.speed = 5; self._move_migrated = function (speed) { self.y += speed; }; return self; }); var RandomObstacle = Container.expand(function () { var self = Container.call(this); var randomObstacleGraphics = self.attachAsset('randomObstacle', { anchorX: 0.5, anchorY: 0.5 }); // Make obstacle look threatening with pulsing red effect randomObstacleGraphics.tint = 0xff4444; // Start with red tint // Create pulsing effect to show it's dangerous function startPulse() { tween(randomObstacleGraphics, { tint: 0xff0000 }, { duration: 800, easing: tween.easeInOut, onFinish: function onFinish() { tween(randomObstacleGraphics, { tint: 0xff4444 }, { duration: 800, easing: tween.easeInOut, onFinish: startPulse }); } }); } startPulse(); self.speed = 5; self._move_migrated = function (speed) { self.y += speed; // Remove rotation animation - obstacles should not rotate }; return self; }); var Wall = Container.expand(function () { var self = Container.call(this); var wallGraphics = self.attachAsset('wall', { anchorX: 0.5, anchorY: 0.5 }); }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // Language and Start Screen UI var languageOptions = [{ code: 'en', label: 'English' }, { code: 'tr', label: 'Türkçe' }]; var selectedLanguage = null; var gameStarted = false; // UI containers var startScreenContainer = new Container(); var langTitle = new Text2('Select Language / Dil Seçin', { size: 120, fill: '#3a84f7', font: 'Impact', align: 'center' }); langTitle.anchor.set(0.5, 0.5); langTitle.x = 1024; langTitle.y = 900; startScreenContainer.addChild(langTitle); var langButtons = []; for (var i = 0; i < languageOptions.length; i++) { var btn = new Text2(languageOptions[i].label, { size: 120, fill: '#ffffff', font: 'Impact', align: 'center', dropShadow: true, dropShadowColor: '#222a9a', dropShadowBlur: 5, dropShadowDistance: 7, dropShadowAngle: 0 }); btn.anchor.set(0.5, 0.5); btn.x = 1024 + (i === 0 ? -250 : 250); btn.y = 1100; btn.interactive = true; btn.buttonMode = true; // Closure for event (function (idx, btnObj) { btnObj.down = function (x, y, obj) { selectedLanguage = languageOptions[idx].code; // Highlight selected for (var j = 0; j < langButtons.length; j++) { langButtons[j].setStyle({ fill: j === idx ? '#3a84f7' : '#ffffff' }); } // Show start button if not already if (!startBtn.visible) startBtn.visible = true; }; })(i, btn); langButtons.push(btn); startScreenContainer.addChild(btn); } // Start button var startBtn = new Text2('Start / Başla', { size: 140, fill: '#3a84f7', font: 'Impact', align: 'center', dropShadow: true, dropShadowColor: '#222a9a', dropShadowBlur: 5, dropShadowDistance: 7, dropShadowAngle: 0 }); startBtn.anchor.set(0.5, 0.5); startBtn.x = 1024; startBtn.y = 1400; startBtn.visible = false; startBtn.interactive = true; startBtn.buttonMode = true; startBtn.down = function (x, y, obj) { if (selectedLanguage) { gameStarted = true; startScreenContainer.visible = false; // Optionally, set tutorial text based on language if (selectedLanguage === 'tr') { tutorialTextWhite.setText('Zıplamak için dokun\nSüzülmek için basılı tut'); tutorialText.setText('Zıplamak için dokun\nSüzülmek için basılı tut'); } else { tutorialTextWhite.setText('Tap to Flap\nHold to Float'); tutorialText.setText('Tap to Flap\nHold to Float'); } tutorialText.visible = true; tutorialTextWhite.visible = true; } }; startScreenContainer.addChild(startBtn); // Add to stage game.addChild(startScreenContainer); // Hide tutorial until game starts var tutorialTextWhite = new Text2('Tap to Flap\nHold to Float', { size: 150, fill: '#ffffff', font: 'Impact', align: 'center' }); tutorialTextWhite.anchor.set(.5, 1); tutorialTextWhite.x = -4; tutorialTextWhite.y = -62; tutorialTextWhite.visible = false; LK.gui.bottom.addChild(tutorialTextWhite); var tutorialText = new Text2('Tap to Flap\nHold to Float', { size: 150, fill: '#3a84f7', font: 'Impact', dropShadow: true, dropShadowColor: '#222a9a', dropShadowBlur: 5, dropShadowDistance: 7, dropShadowAngle: 0, align: 'center' }); tutorialText.anchor.set(.5, 1); tutorialText.y = -50; tutorialText.visible = false; LK.gui.bottom.addChild(tutorialText); // Level definitions var levels = [{ name: "Easy", obstacleSpeed: 5, obstacleSpeedIncrease: 0.005, obstacleSpawnRandomness: 120, obstacleSpawnRandomnessDecrease: 0.025 * (2 / 3), backgroundColor: 0xadd8e6, scoreToNext: 10 }, { name: "Medium", obstacleSpeed: 7, obstacleSpeedIncrease: 0.008, obstacleSpawnRandomness: 90, obstacleSpawnRandomnessDecrease: 0.035, backgroundColor: 0x87ceeb, scoreToNext: 20 }, { name: "Hard", obstacleSpeed: 10, obstacleSpeedIncrease: 0.012, obstacleSpawnRandomness: 60, obstacleSpawnRandomnessDecrease: 0.05, backgroundColor: 0x4682b4, scoreToNext: 9999 // Last level, no next }]; var currentLevelIndex = 0; var currentLevel = levels[currentLevelIndex]; function applyLevel(level) { game.obstacleSpeed = level.obstacleSpeed; game.obstacleSpeedIncrease = level.obstacleSpeedIncrease; obstacleSpawnRandomness = level.obstacleSpawnRandomness; obstacleSpawnRandomnessDecrease = level.obstacleSpawnRandomnessDecrease; game.setBackgroundColor(level.backgroundColor); } game.score = 0; applyLevel(currentLevel); game.checkObstacleCollision = function (obstacles) { for (var i = 0; i < obstacles.length; i++) { obstacles[i]._move_migrated(); var dist = Math.sqrt(Math.pow(bird.x - obstacles[i].x, 2) + Math.pow(bird.y - obstacles[i].y, 2)); if (dist < 280) { LK.setScore(game.score); LK.getSound('gameOverJingle').play(); LK.showGameOver(); } } }; game.setBackgroundColor(currentLevel.backgroundColor); var scoreText = new Text2('0', { size: 150, fill: '#3a84f7', font: 'Impact', dropShadow: true, dropShadowColor: '#222a9a', dropShadowBlur: 5, dropShadowDistance: 7, dropShadowAngle: 0 }); scoreText.anchor.set(.5, 0); LK.gui.top.addChild(scoreText); var scoreText2 = new Text2('0', { size: 150, fill: '#ffffff', font: 'Impact' }); scoreText2.anchor.set(.5, 0); scoreText2.x = -4; scoreText2.y = -5; LK.gui.top.addChild(scoreText2); LK.gui.top.addChild(scoreText); var bird = game.addChild(new Bird()); var leftWall = game.addChild(new Wall()); leftWall.x = 0; leftWall.y = 1366; var rightWall = game.addChild(new Wall()); rightWall.x = 2048; rightWall.y = 1366; var leftObstacles = [], rightObstacles = []; var coins = []; var coinSpawnTime = Math.floor(Math.random() * 180) + 120; var randomObstacles = []; var randomObstacleSpawnTime = Math.floor(Math.random() * 200) + 150; var obstacleSpawnRandomness = 120; var obstacleSpawnRandomnessDecrease = 0.025 * (2 / 3); var obstacleSpawnY = -500; var leftObstacleSpawnTime = Math.floor(Math.random() * obstacleSpawnRandomness) + obstacleSpawnRandomness; var rightObstacleSpawnTime = Math.floor(Math.random() * obstacleSpawnRandomness) + obstacleSpawnRandomness; bird.x = 1024; bird.y = 1366; game.isMouseDown = false; game.down = function (x, y, obj) { if (!gameStarted) return; bird.flap(); game.isMouseDown = true; }; game.up = function (x, y, obj) { if (!gameStarted) return; game.isMouseDown = false; }; game.update = function () { if (!gameStarted) { // Optionally animate start screen, e.g. blink start button if language selected if (startBtn.visible && LK.ticks % 60 < 30) { startBtn.setStyle({ fill: '#ffffff' }); } else if (startBtn.visible) { startBtn.setStyle({ fill: '#3a84f7' }); } return; } bird._update_migrated(); if (game.score > 2) { tutorialText.y += 5; tutorialTextWhite.y += 5; } scoreText.setText(game.score); scoreText2.setText(game.score); // Level progression if (game.score >= currentLevel.scoreToNext && currentLevelIndex < levels.length - 1) { currentLevelIndex++; currentLevel = levels[currentLevelIndex]; applyLevel(currentLevel); // Optional: show a quick level up text var levelUpText = new Text2('Level ' + (currentLevelIndex + 1) + ': ' + currentLevel.name, { size: 120, fill: '#ffffff', font: 'Impact', dropShadow: true, dropShadowColor: '#222a9a', dropShadowBlur: 5, dropShadowDistance: 7, dropShadowAngle: 0, align: 'center' }); levelUpText.anchor.set(.5, .5); levelUpText.x = 1024; levelUpText.y = 1366; game.addChild(levelUpText); LK.setTimeout(function () { levelUpText.destroy(); }, 1200); } game.obstacleSpeed += game.obstacleSpeedIncrease; obstacleSpawnRandomness -= obstacleSpawnRandomnessDecrease; if (obstacleSpawnRandomness < 20) { obstacleSpawnRandomness = 20; } if (LK.ticks >= leftObstacleSpawnTime) { var newObstacle = game.addChildAt(new Obstacle(), 0); newObstacle.x = 0; newObstacle.y = obstacleSpawnY; leftObstacles.push(newObstacle); leftObstacleSpawnTime += Math.floor(Math.random() * obstacleSpawnRandomness) + obstacleSpawnRandomness; } if (LK.ticks >= rightObstacleSpawnTime) { var newObstacle = game.addChildAt(new Obstacle(), 0); newObstacle.x = 2048; newObstacle.y = -newObstacle.height; rightObstacles.push(newObstacle); rightObstacleSpawnTime += Math.floor(Math.random() * obstacleSpawnRandomness) + obstacleSpawnRandomness; } if (bird.intersects(leftWall) && bird.xSpeed < 0 || bird.intersects(rightWall) && bird.xSpeed > 0) { bird.xSpeed = -bird.xSpeed; bird.flip(); game.score++; LK.setScore(game.score); LK.getSound('bounce').play(); } for (var i = leftObstacles.length - 1; i >= 0; i--) { leftObstacles[i]._move_migrated(game.obstacleSpeed); if (leftObstacles[i].y > 3232) { leftObstacles[i].destroy(); leftObstacles.splice(i, 1); } } for (var i = rightObstacles.length - 1; i >= 0; i--) { rightObstacles[i]._move_migrated(game.obstacleSpeed); if (rightObstacles[i].y > 3232) { rightObstacles[i].destroy(); rightObstacles.splice(i, 1); } } // Spawn coins randomly if (LK.ticks >= coinSpawnTime) { var newCoin = game.addChildAt(new Coin(), 0); newCoin.x = Math.random() * 1500 + 274; // Random x between walls newCoin.y = -100; // Check if there's a random obstacle at similar height and adjust coin position var tooClose = false; for (var j = 0; j < randomObstacles.length; j++) { if (Math.abs(randomObstacles[j].y - newCoin.y) < 200) { tooClose = true; break; } } if (tooClose) { newCoin.y = -300; // Spawn higher if obstacle nearby } coins.push(newCoin); coinSpawnTime = LK.ticks + Math.floor(Math.random() * 240) + 180; } // Spawn random obstacles if (LK.ticks >= randomObstacleSpawnTime) { var newRandomObstacle = game.addChildAt(new RandomObstacle(), 0); newRandomObstacle.x = Math.random() * 1400 + 324; // Random x between walls with margin newRandomObstacle.y = -150; randomObstacles.push(newRandomObstacle); randomObstacleSpawnTime = LK.ticks + Math.floor(Math.random() * 300) + 200; } // Update coins and check collection for (var i = coins.length - 1; i >= 0; i--) { coins[i]._move_migrated(game.obstacleSpeed * 0.8); // Check if bird collected coin if (!coins[i].collected && bird.intersects(coins[i])) { coins[i].collected = true; game.score += 2; // Coins give 2 points LK.setScore(game.score); LK.getSound('coinCollect').play(); coins[i].destroy(); coins.splice(i, 1); continue; } // Remove coins that went off screen if (coins[i].y > 3232) { coins[i].destroy(); coins.splice(i, 1); } } // Update random obstacles and check collision for (var i = randomObstacles.length - 1; i >= 0; i--) { randomObstacles[i]._move_migrated(game.obstacleSpeed); // Check collision with bird if (bird.intersects(randomObstacles[i])) { LK.setScore(game.score); LK.getSound('gameOverJingle').play(); LK.showGameOver(); return; } // Remove random obstacles that went off screen if (randomObstacles[i].y > 3232) { randomObstacles[i].destroy(); randomObstacles.splice(i, 1); } } game.checkObstacleCollision(leftObstacles); game.checkObstacleCollision(rightObstacles); if (bird.y < 0 || bird.y > 2732) { LK.setScore(game.score); LK.getSound('gameOverJingle').play(); LK.showGameOver(); } };
===================================================================
--- original.js
+++ change.js
@@ -1,5 +1,10 @@
/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
* Classes
****/
var Bird = Container.expand(function () {
var self = Container.call(this);
@@ -77,31 +82,29 @@
var randomObstacleGraphics = self.attachAsset('randomObstacle', {
anchorX: 0.5,
anchorY: 0.5
});
- // Add red warning lines around the obstacle
- var warningLine1 = self.attachAsset('warningLine', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- warningLine1.y = -80;
- var warningLine2 = self.attachAsset('warningLine', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- warningLine2.y = 80;
- var warningLine3 = self.attachAsset('warningLine', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- warningLine3.rotation = Math.PI / 2;
- warningLine3.x = -200;
- var warningLine4 = self.attachAsset('warningLine', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- warningLine4.rotation = Math.PI / 2;
- warningLine4.x = 200;
+ // Make obstacle look threatening with pulsing red effect
+ randomObstacleGraphics.tint = 0xff4444; // Start with red tint
+ // Create pulsing effect to show it's dangerous
+ function startPulse() {
+ tween(randomObstacleGraphics, {
+ tint: 0xff0000
+ }, {
+ duration: 800,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ tween(randomObstacleGraphics, {
+ tint: 0xff4444
+ }, {
+ duration: 800,
+ easing: tween.easeInOut,
+ onFinish: startPulse
+ });
+ }
+ });
+ }
+ startPulse();
self.speed = 5;
self._move_migrated = function (speed) {
self.y += speed;
// Remove rotation animation - obstacles should not rotate