/**** * Plugins ****/ var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Bird = Container.expand(function () { var self = Container.call(this); var birdGraphics = self.attachAsset('bird', { anchorX: 0.5, anchorY: 0.5 }); self.graphics = birdGraphics; self.xSpeed = 10.9375; self.ySpeed = -20; self.gravity = 1; self.lift = -jumpSpeed; self.isInAir = false; self.flap = function () { if (self.isInAir < 1 || self.isInAir === 1 && canDoubleJump) { self.ySpeed = -jumpSpeed * 1.5; self.isInAir += 1; if (showShadow) { var shadow = game.addChild(new Shadow()); // Add a shadow particle shadow.x = self.x; // Position the shadow at the bird's current position shadow.y = self.y; shadow.scale.x = self.scale.x; // Ensure the shadow graphics scale x matches the cats at the time it's spawned } } if (bird.intersects(leftWall)) { bird.xSpeed = 30; // Add positive x speed when bird jumps from the left wall } else if (bird.intersects(rightWall)) { bird.xSpeed = -30; // Add negative x speed when bird jumps from the right wall } }; 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; } if (self.xSpeed === 0) { birdGraphics.scale.x = bird.intersects(leftWall) ? -1 : 1; } else { birdGraphics.scale.x = self.xSpeed > 0 ? -1 : 1; } // Bird rotation removed }; }); var Obstacle = Container.expand(function () { var self = Container.call(this); var obstacleGraphics = self.attachAsset('obstacle', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; self._move_migrated = function (speed) { self.y += speed; }; }); var Shadow = Container.expand(function () { var self = Container.call(this); var shadowGraphics = self.attachAsset('bird', { anchorX: 0.5, anchorY: 0.5 }); self.graphics = shadowGraphics; shadowGraphics.tint = 0x280924; // Tint the shadow to bright fuschia shadowGraphics.alpha = 1; // Make the shadow semi-transparent self.fadeOut = function () { // Delay the start of the fade out by 200ms LK.setTimeout(function () { if (shadowGraphics.alpha > 0) { shadowGraphics.alpha -= 0.05; // Gradually decrease the alpha to create a fade out effect } else { self.destroy(); // Destroy the shadow when it's fully transparent } }, 200); }; }); 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: 0x111111 }); /**** * Game Code ****/ // High score system with proper initialization //Storage library which should be used for persistent game data var highScores = []; var maxHighScores = 10; // Initialize high scores from storage try { highScores = storage.highScores || []; if (!Array.isArray(highScores)) { highScores = []; } } catch (e) { highScores = []; } // Function to add new high score function addHighScore(score) { highScores.push(score); highScores.sort(function (a, b) { return b - a; }); // Sort descending if (highScores.length > maxHighScores) { highScores = highScores.slice(0, maxHighScores); } // Save to storage with error handling try { storage.highScores = highScores; } catch (e) { console.log('Error saving high scores:', e); } } // Function to check if score is a high score function isHighScore(score) { return highScores.length < maxHighScores || score > highScores[highScores.length - 1]; } // Leaderboard display function function showLeaderboard() { var leaderboardText = 'SKOR LİSTESİ\n\n'; for (var i = 0; i < Math.min(highScores.length, 5); i++) { leaderboardText += i + 1 + '. ' + highScores[i] + '\n'; } if (highScores.length === 0) { leaderboardText += 'Henüz skor yok!'; } try { var leaderboard = new Text2(leaderboardText, { size: 80, fill: '#ffffff', dropShadow: true, dropShadowColor: '#000000', dropShadowBlur: 5, dropShadowDistance: 5, dropShadowAngle: 0 }); leaderboard.anchor.set(0.5, 0.5); leaderboard.x = 1024; leaderboard.y = 1366; game.addChild(leaderboard); // Remove leaderboard after 3 seconds LK.setTimeout(function () { if (leaderboard && leaderboard.parent) { leaderboard.destroy(); } }, 3000); } catch (e) { console.log('Error showing leaderboard:', e); } } var canDoubleJump = true; var framesPerShadow = 4; var showShadow = true; var jumpSpeed = 12; // Starting jump speed (slower than original -15) game.score = 0; game.obstacleSpeed = 5; game.obstacleSpeedIncrease = 0.005; game.simulatedY = 0; 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) { // Flash screen red for dramatic effect LK.effects.flashScreen(0xff0000, 500); // Flash the bird white for impact effect LK.effects.flashObject(bird, 0xffffff, 300); // Play jump sound as game over sound LK.getSound('jump').play(); LK.setScore(game.score); // Check and save high score if (isHighScore(game.score)) { addHighScore(game.score); showLeaderboard(); } // Save final game state and mark as ended try { storage.vintowlParkourGameState.gameRunning = false; storage.vintowlParkourGameState.finalScore = game.score; } catch (e) { console.log('Error saving final state:', e); } // Delay game over screen to show the flash effect LK.setTimeout(function () { LK.showGameOver(); }, 300); } } }; var background = game.addChild(LK.getAsset('background', { anchorX: 0.5, anchorY: 1, x: 1024, y: 2732 })); var scoreText = new Text2('0', { size: 150, fill: '#ffffff', 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' }); scoreText2.anchor.set(.5, 0); scoreText2.x = -4; scoreText2.y = -5; LK.gui.top.addChild(scoreText2); LK.gui.top.addChild(scoreText); // High score display var currentBestScore = highScores.length > 0 ? highScores[0] : 0; var highScoreText = new Text2('High Score: ' + currentBestScore, { size: 80, fill: '#ffff00', dropShadow: true, dropShadowColor: '#000000', dropShadowBlur: 3, dropShadowDistance: 3, dropShadowAngle: 0 }); highScoreText.anchor.set(0.5, 0); highScoreText.y = 180; LK.gui.top.addChild(highScoreText); 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 obstacleSpawnRandomness = 240; var obstacleSpawnRandomnessDecrease = 0.015; var obstacleSpawnY = -500; var leftObstacleSpawnTime = Math.floor(Math.random() * obstacleSpawnRandomness) + obstacleSpawnRandomness; var rightObstacleSpawnTime = Math.floor(Math.random() * obstacleSpawnRandomness) + obstacleSpawnRandomness; // Try to load saved game state, otherwise use default position if (!loadGameState()) { bird.x = 1024; bird.y = 1366; } game.isMouseDown = false; game.isUpEventTriggered = true; game.isUpEventTriggered = true; game.on('down', function (x, y, obj) { if (game.isUpEventTriggered) { bird.flap(); game.isMouseDown = true; game.isUpEventTriggered = false; } }); game.on('up', function (x, y, obj) { game.isMouseDown = false; game.isUpEventTriggered = true; }); // Enhanced save game state function function saveGameState() { try { storage.vintowlParkourGameState = { score: game.score, jumpSpeed: jumpSpeed, obstacleSpeed: game.obstacleSpeed, obstacleSpawnRandomness: obstacleSpawnRandomness, birdPosition: { x: bird.x, y: bird.y }, simulatedY: game.simulatedY, timestamp: Date.now(), gameRunning: true }; console.log('Game state saved successfully'); } catch (e) { console.log('Error saving game state:', e); } } // Load game state function function loadGameState() { try { var savedState = storage.vintowlParkourGameState; if (savedState && savedState.gameRunning) { game.score = savedState.score || 0; jumpSpeed = savedState.jumpSpeed || 12; game.obstacleSpeed = savedState.obstacleSpeed || 5; obstacleSpawnRandomness = savedState.obstacleSpawnRandomness || 240; game.simulatedY = savedState.simulatedY || 0; if (savedState.birdPosition) { bird.x = savedState.birdPosition.x; bird.y = savedState.birdPosition.y; } console.log('Game state loaded successfully'); return true; } } catch (e) { console.log('Error loading game state:', e); } return false; } // Auto-save every 5 seconds var autoSaveTimer = LK.setInterval(function () { saveGameState(); }, 5000); // Initial save saveGameState(); LK.on('tick', function () { bird._update_migrated(); // Update the shadow particles var shadowCount = 0; for (var i = game.children.length - 1; i >= 0; i--) { if (game.children[i] instanceof Shadow) { game.children[i].fadeOut(); shadowCount++; } // If there are more than 15 shadow particles, remove the oldest one if (shadowCount > 12) { game.children[i].destroy(); } } // Spawn the shadows every few frames, while the cat is in the air if (bird.isInAir && showShadow && LK.ticks % framesPerShadow == 0) { var shadow = game.addChildAt(new Shadow(), game.getChildIndex(bird)); // Add a shadow particle behind the bird shadow.x = bird.x; // Position the shadow at the bird's current position shadow.y = bird.y; shadow.graphics.scale.x = bird.graphics.scale.x; // Ensure the shadow graphics scale x matches the bird at the time it's spawned } scoreText.setText(game.score); scoreText2.setText(game.score); // Update high score display var currentHighScore = highScores.length > 0 ? highScores[0] : 0; if (game.score > currentHighScore) { currentHighScore = game.score; highScoreText.setText('High Score: ' + currentHighScore + ' (NEW!)'); highScoreText.fill = '#ff0000'; // Red color for new high score } else { highScoreText.setText('High Score: ' + currentHighScore); highScoreText.fill = '#ffff00'; // Yellow color for existing high score } game.obstacleSpeed += game.obstacleSpeedIncrease; obstacleSpawnRandomness -= obstacleSpawnRandomnessDecrease; if (obstacleSpawnRandomness < 40) { obstacleSpawnRandomness = 40; } if (LK.ticks >= leftObstacleSpawnTime) { var newObstacle = game.addChild(new Obstacle()); newObstacle.x = -10 + newObstacle.width * 0.5; newObstacle.y = obstacleSpawnY; leftObstacles.push(newObstacle); leftObstacleSpawnTime += Math.floor(Math.random() * obstacleSpawnRandomness) + obstacleSpawnRandomness; } if (LK.ticks >= rightObstacleSpawnTime) { var newObstacle = game.addChild(new Obstacle()); newObstacle.x = 2048 + 10 - newObstacle.width * 0.5; newObstacle.y = -newObstacle.height; newObstacle.scale.x *= -1; // Flip the obstacle horizontally rightObstacles.push(newObstacle); rightObstacleSpawnTime += Math.floor(Math.random() * obstacleSpawnRandomness) + obstacleSpawnRandomness; } if (bird.intersects(leftWall) || bird.intersects(rightWall)) { bird.ySpeed = game.obstacleSpeed; bird.xSpeed = 0; bird.isInAir = 0; } 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); } } game.checkObstacleCollision(leftObstacles); game.checkObstacleCollision(rightObstacles); game.simulatedY += game.obstacleSpeed; if (bird.y < 0 || bird.y > 2732) { // Flash screen blue for boundary collision LK.effects.flashScreen(0x0066ff, 500); // Flash the bird yellow for boundary impact effect LK.effects.flashObject(bird, 0xffff00, 300); // Play jump sound as game over sound LK.getSound('jump').play(); LK.setScore(game.score); // Check and save high score if (isHighScore(game.score)) { addHighScore(game.score); showLeaderboard(); } // Save final game state and mark as ended try { storage.vintowlParkourGameState.gameRunning = false; storage.vintowlParkourGameState.finalScore = game.score; } catch (e) { console.log('Error saving final state:', e); } // Delay game over screen to show the flash effect LK.setTimeout(function () { LK.showGameOver(); }, 300); } else { game.score = Math.floor(game.simulatedY / 200); // Gradually increase jump speed based on score (starts at 12, reaches ~18 at score 444) jumpSpeed = 12 + game.score * 0.014; // Check for win condition when score reaches 444 if (game.score >= 444) { // Save final winning state try { storage.vintowlParkourGameState.gameRunning = false; storage.vintowlParkourGameState.finalScore = game.score; storage.vintowlParkourGameState.hasWon = true; } catch (e) { console.log('Error saving win state:', e); } LK.setScore(game.score); LK.showYouWin(); } } });
/****
* Plugins
****/
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Bird = Container.expand(function () {
var self = Container.call(this);
var birdGraphics = self.attachAsset('bird', {
anchorX: 0.5,
anchorY: 0.5
});
self.graphics = birdGraphics;
self.xSpeed = 10.9375;
self.ySpeed = -20;
self.gravity = 1;
self.lift = -jumpSpeed;
self.isInAir = false;
self.flap = function () {
if (self.isInAir < 1 || self.isInAir === 1 && canDoubleJump) {
self.ySpeed = -jumpSpeed * 1.5;
self.isInAir += 1;
if (showShadow) {
var shadow = game.addChild(new Shadow()); // Add a shadow particle
shadow.x = self.x; // Position the shadow at the bird's current position
shadow.y = self.y;
shadow.scale.x = self.scale.x; // Ensure the shadow graphics scale x matches the cats at the time it's spawned
}
}
if (bird.intersects(leftWall)) {
bird.xSpeed = 30; // Add positive x speed when bird jumps from the left wall
} else if (bird.intersects(rightWall)) {
bird.xSpeed = -30; // Add negative x speed when bird jumps from the right wall
}
};
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;
}
if (self.xSpeed === 0) {
birdGraphics.scale.x = bird.intersects(leftWall) ? -1 : 1;
} else {
birdGraphics.scale.x = self.xSpeed > 0 ? -1 : 1;
}
// Bird rotation removed
};
});
var Obstacle = Container.expand(function () {
var self = Container.call(this);
var obstacleGraphics = self.attachAsset('obstacle', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5;
self._move_migrated = function (speed) {
self.y += speed;
};
});
var Shadow = Container.expand(function () {
var self = Container.call(this);
var shadowGraphics = self.attachAsset('bird', {
anchorX: 0.5,
anchorY: 0.5
});
self.graphics = shadowGraphics;
shadowGraphics.tint = 0x280924; // Tint the shadow to bright fuschia
shadowGraphics.alpha = 1; // Make the shadow semi-transparent
self.fadeOut = function () {
// Delay the start of the fade out by 200ms
LK.setTimeout(function () {
if (shadowGraphics.alpha > 0) {
shadowGraphics.alpha -= 0.05; // Gradually decrease the alpha to create a fade out effect
} else {
self.destroy(); // Destroy the shadow when it's fully transparent
}
}, 200);
};
});
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: 0x111111
});
/****
* Game Code
****/
// High score system with proper initialization
//Storage library which should be used for persistent game data
var highScores = [];
var maxHighScores = 10;
// Initialize high scores from storage
try {
highScores = storage.highScores || [];
if (!Array.isArray(highScores)) {
highScores = [];
}
} catch (e) {
highScores = [];
}
// Function to add new high score
function addHighScore(score) {
highScores.push(score);
highScores.sort(function (a, b) {
return b - a;
}); // Sort descending
if (highScores.length > maxHighScores) {
highScores = highScores.slice(0, maxHighScores);
}
// Save to storage with error handling
try {
storage.highScores = highScores;
} catch (e) {
console.log('Error saving high scores:', e);
}
}
// Function to check if score is a high score
function isHighScore(score) {
return highScores.length < maxHighScores || score > highScores[highScores.length - 1];
}
// Leaderboard display function
function showLeaderboard() {
var leaderboardText = 'SKOR LİSTESİ\n\n';
for (var i = 0; i < Math.min(highScores.length, 5); i++) {
leaderboardText += i + 1 + '. ' + highScores[i] + '\n';
}
if (highScores.length === 0) {
leaderboardText += 'Henüz skor yok!';
}
try {
var leaderboard = new Text2(leaderboardText, {
size: 80,
fill: '#ffffff',
dropShadow: true,
dropShadowColor: '#000000',
dropShadowBlur: 5,
dropShadowDistance: 5,
dropShadowAngle: 0
});
leaderboard.anchor.set(0.5, 0.5);
leaderboard.x = 1024;
leaderboard.y = 1366;
game.addChild(leaderboard);
// Remove leaderboard after 3 seconds
LK.setTimeout(function () {
if (leaderboard && leaderboard.parent) {
leaderboard.destroy();
}
}, 3000);
} catch (e) {
console.log('Error showing leaderboard:', e);
}
}
var canDoubleJump = true;
var framesPerShadow = 4;
var showShadow = true;
var jumpSpeed = 12; // Starting jump speed (slower than original -15)
game.score = 0;
game.obstacleSpeed = 5;
game.obstacleSpeedIncrease = 0.005;
game.simulatedY = 0;
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) {
// Flash screen red for dramatic effect
LK.effects.flashScreen(0xff0000, 500);
// Flash the bird white for impact effect
LK.effects.flashObject(bird, 0xffffff, 300);
// Play jump sound as game over sound
LK.getSound('jump').play();
LK.setScore(game.score);
// Check and save high score
if (isHighScore(game.score)) {
addHighScore(game.score);
showLeaderboard();
}
// Save final game state and mark as ended
try {
storage.vintowlParkourGameState.gameRunning = false;
storage.vintowlParkourGameState.finalScore = game.score;
} catch (e) {
console.log('Error saving final state:', e);
}
// Delay game over screen to show the flash effect
LK.setTimeout(function () {
LK.showGameOver();
}, 300);
}
}
};
var background = game.addChild(LK.getAsset('background', {
anchorX: 0.5,
anchorY: 1,
x: 1024,
y: 2732
}));
var scoreText = new Text2('0', {
size: 150,
fill: '#ffffff',
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'
});
scoreText2.anchor.set(.5, 0);
scoreText2.x = -4;
scoreText2.y = -5;
LK.gui.top.addChild(scoreText2);
LK.gui.top.addChild(scoreText);
// High score display
var currentBestScore = highScores.length > 0 ? highScores[0] : 0;
var highScoreText = new Text2('High Score: ' + currentBestScore, {
size: 80,
fill: '#ffff00',
dropShadow: true,
dropShadowColor: '#000000',
dropShadowBlur: 3,
dropShadowDistance: 3,
dropShadowAngle: 0
});
highScoreText.anchor.set(0.5, 0);
highScoreText.y = 180;
LK.gui.top.addChild(highScoreText);
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 obstacleSpawnRandomness = 240;
var obstacleSpawnRandomnessDecrease = 0.015;
var obstacleSpawnY = -500;
var leftObstacleSpawnTime = Math.floor(Math.random() * obstacleSpawnRandomness) + obstacleSpawnRandomness;
var rightObstacleSpawnTime = Math.floor(Math.random() * obstacleSpawnRandomness) + obstacleSpawnRandomness;
// Try to load saved game state, otherwise use default position
if (!loadGameState()) {
bird.x = 1024;
bird.y = 1366;
}
game.isMouseDown = false;
game.isUpEventTriggered = true;
game.isUpEventTriggered = true;
game.on('down', function (x, y, obj) {
if (game.isUpEventTriggered) {
bird.flap();
game.isMouseDown = true;
game.isUpEventTriggered = false;
}
});
game.on('up', function (x, y, obj) {
game.isMouseDown = false;
game.isUpEventTriggered = true;
});
// Enhanced save game state function
function saveGameState() {
try {
storage.vintowlParkourGameState = {
score: game.score,
jumpSpeed: jumpSpeed,
obstacleSpeed: game.obstacleSpeed,
obstacleSpawnRandomness: obstacleSpawnRandomness,
birdPosition: {
x: bird.x,
y: bird.y
},
simulatedY: game.simulatedY,
timestamp: Date.now(),
gameRunning: true
};
console.log('Game state saved successfully');
} catch (e) {
console.log('Error saving game state:', e);
}
}
// Load game state function
function loadGameState() {
try {
var savedState = storage.vintowlParkourGameState;
if (savedState && savedState.gameRunning) {
game.score = savedState.score || 0;
jumpSpeed = savedState.jumpSpeed || 12;
game.obstacleSpeed = savedState.obstacleSpeed || 5;
obstacleSpawnRandomness = savedState.obstacleSpawnRandomness || 240;
game.simulatedY = savedState.simulatedY || 0;
if (savedState.birdPosition) {
bird.x = savedState.birdPosition.x;
bird.y = savedState.birdPosition.y;
}
console.log('Game state loaded successfully');
return true;
}
} catch (e) {
console.log('Error loading game state:', e);
}
return false;
}
// Auto-save every 5 seconds
var autoSaveTimer = LK.setInterval(function () {
saveGameState();
}, 5000);
// Initial save
saveGameState();
LK.on('tick', function () {
bird._update_migrated();
// Update the shadow particles
var shadowCount = 0;
for (var i = game.children.length - 1; i >= 0; i--) {
if (game.children[i] instanceof Shadow) {
game.children[i].fadeOut();
shadowCount++;
}
// If there are more than 15 shadow particles, remove the oldest one
if (shadowCount > 12) {
game.children[i].destroy();
}
}
// Spawn the shadows every few frames, while the cat is in the air
if (bird.isInAir && showShadow && LK.ticks % framesPerShadow == 0) {
var shadow = game.addChildAt(new Shadow(), game.getChildIndex(bird)); // Add a shadow particle behind the bird
shadow.x = bird.x; // Position the shadow at the bird's current position
shadow.y = bird.y;
shadow.graphics.scale.x = bird.graphics.scale.x; // Ensure the shadow graphics scale x matches the bird at the time it's spawned
}
scoreText.setText(game.score);
scoreText2.setText(game.score);
// Update high score display
var currentHighScore = highScores.length > 0 ? highScores[0] : 0;
if (game.score > currentHighScore) {
currentHighScore = game.score;
highScoreText.setText('High Score: ' + currentHighScore + ' (NEW!)');
highScoreText.fill = '#ff0000'; // Red color for new high score
} else {
highScoreText.setText('High Score: ' + currentHighScore);
highScoreText.fill = '#ffff00'; // Yellow color for existing high score
}
game.obstacleSpeed += game.obstacleSpeedIncrease;
obstacleSpawnRandomness -= obstacleSpawnRandomnessDecrease;
if (obstacleSpawnRandomness < 40) {
obstacleSpawnRandomness = 40;
}
if (LK.ticks >= leftObstacleSpawnTime) {
var newObstacle = game.addChild(new Obstacle());
newObstacle.x = -10 + newObstacle.width * 0.5;
newObstacle.y = obstacleSpawnY;
leftObstacles.push(newObstacle);
leftObstacleSpawnTime += Math.floor(Math.random() * obstacleSpawnRandomness) + obstacleSpawnRandomness;
}
if (LK.ticks >= rightObstacleSpawnTime) {
var newObstacle = game.addChild(new Obstacle());
newObstacle.x = 2048 + 10 - newObstacle.width * 0.5;
newObstacle.y = -newObstacle.height;
newObstacle.scale.x *= -1; // Flip the obstacle horizontally
rightObstacles.push(newObstacle);
rightObstacleSpawnTime += Math.floor(Math.random() * obstacleSpawnRandomness) + obstacleSpawnRandomness;
}
if (bird.intersects(leftWall) || bird.intersects(rightWall)) {
bird.ySpeed = game.obstacleSpeed;
bird.xSpeed = 0;
bird.isInAir = 0;
}
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);
}
}
game.checkObstacleCollision(leftObstacles);
game.checkObstacleCollision(rightObstacles);
game.simulatedY += game.obstacleSpeed;
if (bird.y < 0 || bird.y > 2732) {
// Flash screen blue for boundary collision
LK.effects.flashScreen(0x0066ff, 500);
// Flash the bird yellow for boundary impact effect
LK.effects.flashObject(bird, 0xffff00, 300);
// Play jump sound as game over sound
LK.getSound('jump').play();
LK.setScore(game.score);
// Check and save high score
if (isHighScore(game.score)) {
addHighScore(game.score);
showLeaderboard();
}
// Save final game state and mark as ended
try {
storage.vintowlParkourGameState.gameRunning = false;
storage.vintowlParkourGameState.finalScore = game.score;
} catch (e) {
console.log('Error saving final state:', e);
}
// Delay game over screen to show the flash effect
LK.setTimeout(function () {
LK.showGameOver();
}, 300);
} else {
game.score = Math.floor(game.simulatedY / 200);
// Gradually increase jump speed based on score (starts at 12, reaches ~18 at score 444)
jumpSpeed = 12 + game.score * 0.014;
// Check for win condition when score reaches 444
if (game.score >= 444) {
// Save final winning state
try {
storage.vintowlParkourGameState.gameRunning = false;
storage.vintowlParkourGameState.finalScore = game.score;
storage.vintowlParkourGameState.hasWon = true;
} catch (e) {
console.log('Error saving win state:', e);
}
LK.setScore(game.score);
LK.showYouWin();
}
}
});
A stylized cartoon owl mascot with a sharp business suit, resembling a professional professor or detective. The owl has large expressive orange eyes, a speckled brown head, and detailed feathers. Its body is in mid-jump pose as if performing a parkour leap, arms slightly bent for momentum, legs tucked upward. The style is clean 2D vector art with high contrast, no shadows, and vibrant colors. Purple blazer, golden vest, black tie remain consistent. Background is blank. Focus on dynamic motion and confident energy, game-ready sprite texture.
purple fire spikes. In-Game asset. 2d. High contrast. No shadows
dark purple wall. In-Game asset. 2d. High contrast. No shadows
A cinematic 2D cartoon-style night cityscape featuring a tall, dark purple skyscraper with glowing violet lights. From a distant view, on the top floor, a large glass window reveals the silhouette of a mysterious owl princess. She has a crown, flowing dress, and large glowing orange eyes, barely visible behind the glass. The building reflects moonlight, surrounded by other modern towers and misty clouds. The owl silhouette gives a feeling of sorrow or urgency. High detail background, vector-style with vibrant contrast, no shadows, magical atmosphere. Game-ready, dramatic storytelling frame.. In-Game asset. 2d. High contrast. No shadows