User prompt
Aslan assetimi silin
User prompt
Aslan fotoğraf değişimi iptal et
User prompt
Her 5 seviye geçişinde aslan fotoğrafı değişsin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Sağ alta bir aslan asseti ekleyelim
User prompt
Oyuncu 10 seviye geçtiğinde ekrana great! Yaz
User prompt
Flappy Flight ismini Flying Bird olrak değiştir
User prompt
Please fix the bug: 'TypeError: storage.getItem is not a function' in or related to this line: 'var highScore = storage.getItem('highScore') || 0;' Line Number: 631 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Please fix the bug: 'Uncaught TypeError: storage.get is not a function' in or related to this line: 'var highScore = storage.get('highScore') || 0;' Line Number: 148 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Ayarlar seçeneği rekorların bir üstünde olsun
User prompt
Rekor sistemini ayarlarda değil ayrı bir seçenek olarak olsun
User prompt
Please fix the bug: 'Uncaught TypeError: storage.getItem is not a function' in or related to this line: 'var highScore = storage.getItem('highScore') || 0;' Line Number: 305
User prompt
Rekor sistemini ekleyin
User prompt
Rekor sistemini kaldır
User prompt
Oyuna bir rekor sistemi ekleyin ve ayarlar sekmesinden görüntülensin ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Bulutun opaklığını arttırın
User prompt
Üst bulutu ortaya çek
User prompt
Far clouds cismini y eksenini biraz aşağı çekin
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'then')' in or related to this line: 'tween(self, {' Line Number: 40
User prompt
Arka planı 3d gibi efektler ekleyelim
User prompt
Son dediğimi iptal et
User prompt
Oyunda karekter zıplamasına göre hareket eden ağaçlar ekle ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Son dediğimi iptal et
User prompt
Arka planda kamera açısına göre hareket eden ağaçlar yapalım
User prompt
Ayarlar menüsün yazılarının arkasında gölge olsun
User prompt
Oyuna bir başlama ve ayarlar menüsü ekleyelim
/**** * 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.velocity = 0; self.gravity = 0.5; self.flapStrength = -12; self.isDead = false; self.flap = function () { if (!self.isDead) { self.velocity = self.flapStrength; LK.getSound('flap').play(); // Rotate bird up when flapping tween(self, { rotation: -0.5 }, { duration: 100, easing: tween.linear }); } }; self.update = function () { if (self.isDead) { return; } // Apply gravity and update position self.velocity += self.gravity; self.y += self.velocity; // Rotate bird based on velocity if (self.velocity > 0) { var targetRotation = Math.min(self.velocity * 0.05, 1.2); tween(self, { rotation: targetRotation }, { duration: 100, easing: tween.linear }); } }; self.die = function () { if (!self.isDead) { self.isDead = true; LK.getSound('hit').play(); } }; return self; }); var Menu = Container.expand(function () { var self = Container.call(this); // Create menu background var menuBg = LK.getAsset('background', { anchorX: 0, anchorY: 0, x: 0, y: 0, alpha: 0.8 }); self.addChild(menuBg); // Create title var titleText = new Text2('Flappy Flight', { size: 150, fill: 0xFFFFFF }); titleText.anchor.set(0.5, 0.5); titleText.x = 2048 / 2; titleText.y = 600; self.addChild(titleText); // Create play button var playButton = new Text2('Play', { size: 100, fill: 0xFFFFFF }); playButton.anchor.set(0.5, 0.5); playButton.x = 2048 / 2; playButton.y = 1100; self.addChild(playButton); // Create settings button var settingsButton = new Text2('Settings', { size: 100, fill: 0xFFFFFF }); settingsButton.anchor.set(0.5, 0.5); settingsButton.x = 2048 / 2; settingsButton.y = 1300; self.addChild(settingsButton); // Event handlers playButton.down = function () { if (self.onPlay) { self.onPlay(); } }; settingsButton.down = function () { if (self.onSettings) { self.onSettings(); } }; return self; }); var Pipe = Container.expand(function () { var self = Container.call(this); var topPipe = self.attachAsset('pipeTop', { anchorX: 0.5, anchorY: 1.0 }); var bottomPipe = self.attachAsset('pipeBottom', { anchorX: 0.5, anchorY: 0 }); self.gapHeight = 400; self.gapPosition = 0; self.speed = 5; self.scored = false; self.setGapPosition = function (position) { self.gapPosition = position; // Position pipes to create gap topPipe.y = position - self.gapHeight / 2; bottomPipe.y = position + self.gapHeight / 2; }; self.update = function () { self.x -= self.speed; }; return self; }); var Settings = Container.expand(function () { var self = Container.call(this); // Create settings background var settingsBg = LK.getAsset('background', { anchorX: 0, anchorY: 0, x: 0, y: 0, alpha: 0.8 }); self.addChild(settingsBg); // Create title var titleText = new Text2('Settings', { size: 150, fill: 0xFFFFFF, shadow: { color: 0x000000, blur: 10, offsetX: 3, offsetY: 3 } }); titleText.anchor.set(0.5, 0.5); titleText.x = 2048 / 2; titleText.y = 600; self.addChild(titleText); // Music toggle var musicText = new Text2('Music: ON', { size: 100, fill: 0xFFFFFF, shadow: { color: 0x000000, blur: 10, offsetX: 3, offsetY: 3 } }); musicText.anchor.set(0.5, 0.5); musicText.x = 2048 / 2; musicText.y = 1000; self.addChild(musicText); // Sound toggle var soundText = new Text2('Sound: ON', { size: 100, fill: 0xFFFFFF, shadow: { color: 0x000000, blur: 10, offsetX: 3, offsetY: 3 } }); soundText.anchor.set(0.5, 0.5); soundText.x = 2048 / 2; soundText.y = 1200; self.addChild(soundText); // Back button var backButton = new Text2('Back', { size: 100, fill: 0xFFFFFF, shadow: { color: 0x000000, blur: 10, offsetX: 3, offsetY: 3 } }); backButton.anchor.set(0.5, 0.5); backButton.x = 2048 / 2; backButton.y = 1400; self.addChild(backButton); // State variables self.musicEnabled = true; self.soundEnabled = true; // Event handlers musicText.down = function () { self.musicEnabled = !self.musicEnabled; musicText.setText('Music: ' + (self.musicEnabled ? 'ON' : 'OFF')); if (self.onMusicToggle) { self.onMusicToggle(self.musicEnabled); } }; soundText.down = function () { self.soundEnabled = !self.soundEnabled; soundText.setText('Sound: ' + (self.soundEnabled ? 'ON' : 'OFF')); if (self.onSoundToggle) { self.onSoundToggle(self.soundEnabled); } }; backButton.down = function () { if (self.onBack) { self.onBack(); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB }); /**** * Game Code ****/ // Game variables var bird; var pipes = []; var ground; var background; var isGameStarted = false; var pipeSpawnTimer = 0; var pipeSpawnInterval = 120; // frames (2 seconds at 60fps) var lastPipeX = 0; var gameover = false; // Menu management var mainMenu; var settingsMenu; var gameState = 'MENU'; // MENU, SETTINGS, GAME var musicEnabled = true; var soundEnabled = true; // GUI var scoreTxt = new Text2('0', { size: 120, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Create tap to start text (but don't add it yet) var startTxt = new Text2('Tap to Start', { size: 80, fill: 0xFFFFFF }); startTxt.anchor.set(0.5, 0.5); // Create background background = LK.getAsset('background', { anchorX: 0, anchorY: 0, x: 0, y: 0 }); game.addChild(background); // Create ground ground = LK.getAsset('ground', { anchorX: 0, anchorY: 0, x: 0, y: 2732 - 100 }); game.addChild(ground); // Create bird bird = new Bird(); bird.x = 400; bird.y = 2732 / 2; game.addChild(bird); // Create menus mainMenu = new Menu(); mainMenu.onPlay = function () { showGame(); }; mainMenu.onSettings = function () { showSettings(); }; game.addChild(mainMenu); settingsMenu = new Settings(); settingsMenu.onBack = function () { showMainMenu(); }; settingsMenu.onMusicToggle = function (enabled) { musicEnabled = enabled; if (enabled) { LK.playMusic('gameMusic', { fade: { start: 0, end: 0.4, duration: 1000 } }); } else { LK.stopMusic(); } }; settingsMenu.onSoundToggle = function (enabled) { soundEnabled = enabled; }; settingsMenu.visible = false; game.addChild(settingsMenu); // Start music LK.playMusic('gameMusic', { fade: { start: 0, end: 0.4, duration: 1000 } }); // Game functions function spawnPipe() { var pipe = new Pipe(); pipe.x = 2048 + 150; // Start just off-screen // Random gap position between 500 and 2732-500 (avoiding too close to top/bottom) var minY = 500; var maxY = 2732 - 500; var gapY = minY + Math.random() * (maxY - minY); pipe.setGapPosition(gapY); pipes.push(pipe); game.addChild(pipe); // Place pipe behind bird but in front of background game.setChildIndex(pipe, 1); lastPipeX = pipe.x; } function startGame() { if (!isGameStarted) { isGameStarted = true; gameover = false; LK.setScore(0); scoreTxt.setText(0); // Start music if enabled if (musicEnabled) { LK.playMusic('gameMusic', { fade: { start: 0, end: 0.4, duration: 1000 } }); } // Remove start text if (startTxt.parent) { startTxt.parent.removeChild(startTxt); } // Initial bird flap with sound based on settings if (soundEnabled) { bird.flap(); } else { // Just apply velocity without sound bird.velocity = bird.flapStrength; tween(bird, { rotation: -0.5 }, { duration: 100, easing: tween.linear }); } } } function checkCollisions() { // Check if bird hits ground if (bird.y + 40 > ground.y) { bird.y = ground.y - 40; // Prevent bird from going through ground gameOver(); return true; } // Check if bird hits ceiling if (bird.y - 40 < 0) { bird.y = 40; // Prevent bird from going through ceiling bird.velocity = 0; } // Check collision with pipes for (var i = 0; i < pipes.length; i++) { var pipe = pipes[i]; // Get pipe children (top and bottom pipes) var topPipe = pipe.children[0]; var bottomPipe = pipe.children[1]; // Calculate collision areas var birdLeft = bird.x - 40; var birdRight = bird.x + 40; var birdTop = bird.y - 40; var birdBottom = bird.y + 40; var pipeLeft = pipe.x - 75; var pipeRight = pipe.x + 75; var topPipeBottom = pipe.gapPosition - pipe.gapHeight / 2; var bottomPipeTop = pipe.gapPosition + pipe.gapHeight / 2; // Check for collision if (birdRight > pipeLeft && birdLeft < pipeRight) { if (birdTop < topPipeBottom || birdBottom > bottomPipeTop) { gameOver(); return true; } } // Check for score if (!pipe.scored && birdLeft > pipe.x) { pipe.scored = true; LK.setScore(LK.getScore() + 1); scoreTxt.setText(LK.getScore()); LK.getSound('score').play(); } } return false; } function gameOver() { if (!gameover) { gameover = true; bird.die(); // Flash screen and show game over LK.effects.flashScreen(0xFF0000, 500); // Wait a moment before showing game over LK.setTimeout(function () { LK.showGameOver(); // After game over, show the main menu again LK.setTimeout(function () { showMainMenu(); }, 500); }, 1000); } } function showMainMenu() { gameState = 'MENU'; mainMenu.visible = true; settingsMenu.visible = false; bird.visible = false; // Hide the game elements for (var i = 0; i < pipes.length; i++) { pipes[i].visible = false; } // Remove start text if visible if (startTxt.parent) { startTxt.parent.removeChild(startTxt); } } function showSettings() { gameState = 'SETTINGS'; mainMenu.visible = false; settingsMenu.visible = true; bird.visible = false; } function showGame() { gameState = 'GAME'; mainMenu.visible = false; settingsMenu.visible = false; bird.visible = true; // Show all game elements for (var i = 0; i < pipes.length; i++) { pipes[i].visible = true; } resetGame(); // Add the start text LK.gui.center.addChild(startTxt); } function resetGame() { // Remove all pipes for (var i = pipes.length - 1; i >= 0; i--) { game.removeChild(pipes[i]); pipes[i].destroy(); } pipes = []; // Reset bird bird.velocity = 0; bird.rotation = 0; bird.y = 2732 / 2; bird.isDead = false; // Reset game state isGameStarted = false; gameover = false; pipeSpawnTimer = 0; LK.setScore(0); scoreTxt.setText("0"); // Show start text LK.gui.center.addChild(startTxt); } // Input handlers game.down = function (x, y, obj) { if (gameState === 'MENU' || gameState === 'SETTINGS') { // Menu input is handled by menu button objects return; } if (!isGameStarted) { startGame(); } else if (!gameover) { if (soundEnabled) { bird.flap(); } else { // Just update velocity without sound bird.velocity = bird.flapStrength; // Rotate bird up when flapping tween(bird, { rotation: -0.5 }, { duration: 100, easing: tween.linear }); } } }; // Game update loop game.update = function () { // If in menu or settings, don't update game logic if (gameState === 'MENU' || gameState === 'SETTINGS') { return; } if (!isGameStarted) { // Bird gently floats up and down before game starts bird.y = 2732 / 2 + Math.sin(LK.ticks / 30) * 20; return; } if (!gameover) { // Update bird bird.update(); // Spawn pipes pipeSpawnTimer++; if (pipeSpawnTimer >= pipeSpawnInterval) { spawnPipe(); pipeSpawnTimer = 0; } // Update and clean up pipes for (var i = pipes.length - 1; i >= 0; i--) { pipes[i].update(); // Remove pipes that are off-screen if (pipes[i].x < -200) { game.removeChild(pipes[i]); pipes[i].destroy(); pipes.splice(i, 1); } } // Check collisions checkCollisions(); } };
===================================================================
--- original.js
+++ change.js
@@ -1,9 +1,8 @@
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
-var facekit = LK.import("@upit/facekit.v1");
/****
* Classes
****/
@@ -55,41 +54,8 @@
}
};
return self;
});
-var CameraController = Container.expand(function () {
- var self = Container.call(this);
- // Initialize face tracking
- self.initialize = function () {
- facekit.start();
- facekit.on('update', self.onFaceUpdate);
- };
- // Face tracking update handler
- self.onFaceUpdate = function (faces) {
- if (faces && faces.length > 0) {
- // Get primary face position (normalized from -1 to 1)
- var face = faces[0];
- // Update the camera offset property which other objects can use
- self.cameraOffsetX = face.x * 300; // Scale for desired movement range
- } else {
- // No face detected, gradually return to center
- if (self.cameraOffsetX) {
- self.cameraOffsetX *= 0.9; // Smoothly return to 0
- if (Math.abs(self.cameraOffsetX) < 0.1) {
- self.cameraOffsetX = 0;
- }
- }
- }
- };
- // Clean up when destroyed
- self.destroy = function () {
- facekit.off('update', self.onFaceUpdate);
- facekit.stop();
- };
- // Initial values
- self.cameraOffsetX = 0;
- return self;
-});
var Menu = Container.expand(function () {
var self = Container.call(this);
// Create menu background
var menuBg = LK.getAsset('background', {
@@ -260,39 +226,8 @@
}
};
return self;
});
-var Tree = Container.expand(function () {
- var self = Container.call(this);
- // Create tree trunk
- var trunk = LK.getAsset('ground', {
- anchorX: 0.5,
- anchorY: 1.0,
- width: 50,
- height: 300,
- tint: 0x6B4226
- });
- self.addChild(trunk);
- // Create tree top (foliage)
- var foliage = LK.getAsset('ground', {
- anchorX: 0.5,
- anchorY: 1.0,
- width: 200,
- height: 250,
- tint: 0x228B22,
- shape: 'ellipse'
- });
- foliage.y = -250;
- self.addChild(foliage);
- // Properties for parallax effect
- self.parallaxFactor = 1; // Movement factor (1 = full movement, 0.5 = half speed, etc.)
- self.baseX = 0; // Original X position
- // Update tree position based on camera offset
- self.updatePosition = function (cameraOffsetX) {
- self.x = self.baseX + cameraOffsetX * self.parallaxFactor;
- };
- return self;
-});
/****
* Initialize Game
****/
@@ -312,10 +247,8 @@
var pipeSpawnTimer = 0;
var pipeSpawnInterval = 120; // frames (2 seconds at 60fps)
var lastPipeX = 0;
var gameover = false;
-var trees = [];
-var cameraController;
// Menu management
var mainMenu;
var settingsMenu;
var gameState = 'MENU'; // MENU, SETTINGS, GAME
@@ -349,47 +282,13 @@
x: 0,
y: 2732 - 100
});
game.addChild(ground);
-// Create trees with different parallax factors (depth)
-function createTrees() {
- // Clear any existing trees
- for (var i = 0; i < trees.length; i++) {
- if (trees[i].parent) {
- trees[i].parent.removeChild(trees[i]);
- }
- }
- trees = [];
- // Create several trees at different positions with different parallax factors
- for (var i = 0; i < 6; i++) {
- var tree = new Tree();
- // Position trees at different spots
- tree.baseX = 200 + i * 350; // Spread trees horizontally
- tree.y = 2732 - 100; // Place on ground
- // Set different parallax factors to create depth effect
- // Trees further away (smaller parallax factor) move less
- tree.parallaxFactor = 0.3 + i % 3 * 0.3; // Values from 0.3 to 0.9
- // Make some trees appear behind and some in front
- if (i % 2 == 0) {
- // Place some trees behind bird
- game.addChildAt(tree, game.getChildIndex(bird));
- } else {
- // Place some trees in front of bird
- game.addChild(tree);
- }
- trees.push(tree);
- }
-}
-// Initialize camera controller for face tracking
-cameraController = new CameraController();
-cameraController.initialize();
// Create bird
bird = new Bird();
bird.x = 400;
bird.y = 2732 / 2;
game.addChild(bird);
-// Create trees in the background
-createTrees();
// Create menus
mainMenu = new Menu();
mainMenu.onPlay = function () {
showGame();
@@ -589,10 +488,8 @@
gameover = false;
pipeSpawnTimer = 0;
LK.setScore(0);
scoreTxt.setText("0");
- // Create trees in the background
- createTrees();
// Show start text
LK.gui.center.addChild(startTxt);
}
// Input handlers
@@ -624,12 +521,8 @@
// If in menu or settings, don't update game logic
if (gameState === 'MENU' || gameState === 'SETTINGS') {
return;
}
- // Update tree positions based on face tracking camera position
- for (var i = 0; i < trees.length; i++) {
- trees[i].updatePosition(cameraController.cameraOffsetX);
- }
if (!isGameStarted) {
// Bird gently floats up and down before game starts
bird.y = 2732 / 2 + Math.sin(LK.ticks / 30) * 20;
return;
Orman vektör tarzda. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Orman vektör gökyüzü gölgeli hafif siyah Arka plan. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Ağaç kütüğü vektör tarzda dik bir adet koyu kahverengi. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Sarı muhabbet kuşu sevimli küçük vektör ve piksel sanatı. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Bulut piksel sanatı. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows