User prompt
DELETE ALL TRACES FOR THE SPACEMAP, IDIOT! Now, we'll delete ground-underscore-space, background-underscore-space, and... background-sky.
User prompt
so that the background for the space map also works like all the other backgrounds.
User prompt
Paint the sound effect landing space for the landing sound effect in the space map. Use the element background space for the background for the space map and create the music track ambience space.
User prompt
Make the laser wall obstacles alternate faster. Also, make the background scrolling and ground scrolling effects scale in the same way as, well, the obstacle movements.
User prompt
Make the ground textures actually move in the same direction as the background but a bit faster to give the illusion of walking.
User prompt
Make all obstacles about 50% taller, both graphically and hitbox.
User prompt
Make instead of the usual red the screen flash turquoise When dying through a laser wall obstacle ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
at a optical laser wall 4, make them, well, make the obstacles laser wall alter between all 4, but make sure that the same laser wall object cannot be twice in a row. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make sure they are not sinking into the ground, but instead start right where the ground ends.
User prompt
so that every obstacle perfectly touches the ground and there is no gap between it and, well, the ground.
User prompt
It's a new music track, Space.
User prompt
the map space to the map selection next to the volcano map.
User prompt
the two assets laser wall 2 and laser wall 3 and make it so that well they are randomly alternating each other to make a small little laser animation but they are supposed to be the same size as laser wall 1 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
the new sound effects landing space and hit laser wall create the new optical asset laser wall
User prompt
a new map space and make the map space well use the asset background sky and rename it to background space also create a new ground ground space
User prompt
achieve a new well rank make a small well a white text box appear on the bottom will fly through to the bottom and stay there and go back down again well saying you've achieved ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Well, make the highscore not appear like a splash text, make it actually open some kind of window.
User prompt
When pressing on the high-score button, make the sound Trophy play, instead of the map button sound. Also, if there is no high-score yet, just show there is no high-score yet. But if there is a high-score... ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Use the currently existing skin's button, Acid, and rename it to HighscoreAcid, well, to HighscoreButton, and use it for a HighscoreButton appearing next to the MapButton. On the right...
User prompt
use the sound effect memories when the play well when the message data successfully cleared appears
User prompt
everything stay dark for the rest of the game until the player has pressed retry in the overlay not connected to the game
User prompt
Please fix the bug: 'TypeError: target is not an Object. (evaluating 'key in target')' in or related to this line: 'tween(darkOverlay, {' Line Number: 902 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'TypeError: target is not an Object. (evaluating 'key in target')' in or related to this line: 'tween(darkOverlay, {' Line Number: 900 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make the sound effect memory Only play once and that once is when the text memory successfully cleared appears I Mean data successfully cleared, of course
User prompt
Use the memory sound effect when the text Data Successfully Cleared appears. Also make the text Data Successfully Cleared red.
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1", {
musicEnabled: false,
ambienceEnabled: true
});
/****
* Classes
****/
var LanguageButton = Container.expand(function (language, callback) {
var self = Container.call(this);
var buttonGraphics = self.attachAsset('menuButton', {
anchorX: 0.5,
anchorY: 0.5
});
self.graphics = buttonGraphics;
var buttonText = new Text2(language, {
size: 120,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.down = function () {
LK.getSound('Gear').play();
if (callback) callback();
};
return self;
});
var LaserWall = Container.expand(function () {
var self = Container.call(this);
self.speed = -24;
self.passed = false;
self.animationTimer = 0;
self.currentLaserType = 'laser_wall';
self.laserAssets = ['laser_wall', 'laser_wall_2', 'laser_wall_3'];
// Create initial laser wall graphics
var laserGraphics = self.attachAsset('laser_wall', {
anchorX: 0.5,
anchorY: 1.0,
scaleX: 3.0,
scaleY: 1.0
});
// Store graphics reference
self.laserGraphics = laserGraphics;
// Set standardized obstacle dimensions - 300x400 pixels
self.width = 300;
self.height = 400;
self.update = function () {
self.x += self.speed;
// Animation timer for laser cycling (change every 10 frames for fast animation)
self.animationTimer++;
if (self.animationTimer >= 10) {
self.animationTimer = 0;
// Randomly select next laser type
var nextLaserType = self.laserAssets[Math.floor(Math.random() * self.laserAssets.length)];
// Only change if it's different from current
if (nextLaserType !== self.currentLaserType) {
// Remove current graphics
if (self.laserGraphics) {
self.removeChild(self.laserGraphics);
}
// Create new graphics with same size and position
self.laserGraphics = self.attachAsset(nextLaserType, {
anchorX: 0.5,
anchorY: 1.0,
scaleX: 3.0,
scaleY: 1.0
});
self.currentLaserType = nextLaserType;
}
}
};
return self;
});
var LavaGeyser = Container.expand(function () {
var self = Container.call(this);
self.speed = -24;
self.passed = false;
self.isErupting = false;
self.eruptionTimer = 0;
self.eruptionInterval = 120; // Erupts every 2 seconds at 60fps
self.eruptionDuration = 30; // Erupts for 0.5 seconds
// Create and attach the lava geyser graphics with standardized scaling
var geyserGraphics = self.attachAsset('lavaGeyser', {
anchorX: 0.5,
anchorY: 1.0,
scaleX: 3.0,
scaleY: 4.0
});
// Store graphics reference for later manipulation
self.geyserGraphics = geyserGraphics;
// Set standardized obstacle dimensions - 300x400 pixels
self.width = 300;
self.height = 400;
self.update = function () {
self.x += self.speed;
// Handle eruption timing
self.eruptionTimer++;
if (!self.isErupting && self.eruptionTimer >= self.eruptionInterval) {
self.isErupting = true;
self.eruptionTimer = 0;
// Make geyser glow bright red when erupting with pulsing effect
self.geyserGraphics.tint = 0xff2222;
self.geyserGraphics.alpha = 0.9 + Math.sin(LK.ticks * 0.5) * 0.1;
} else if (self.isErupting && self.eruptionTimer >= self.eruptionDuration) {
self.isErupting = false;
self.eruptionTimer = 0;
// Return to enhanced normal color for better visibility
self.geyserGraphics.tint = 0xffffff;
self.geyserGraphics.alpha = 1.0;
}
// Add slight vertical movement when erupting
if (self.isErupting) {
self.y += Math.sin(LK.ticks * 0.3) * 3;
}
};
return self;
});
var MenuButton = Container.expand(function (text, callback) {
var self = Container.call(this);
var buttonGraphics = self.attachAsset('menuButton', {
anchorX: 0.5,
anchorY: 0.5
});
var buttonText = new Text2(text, {
size: 120,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.down = function () {
LK.getSound('Lever').play();
if (callback) callback();
};
return self;
});
var MusicButton = Container.expand(function (isEnabled, callback) {
var self = Container.call(this);
var buttonGraphics = self.attachAsset('menuButton', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.8,
scaleY: 0.6
});
self.graphics = buttonGraphics;
self.enabled = isEnabled;
self.callback = callback;
var buttonText = new Text2('MUSIC: ' + (isEnabled ? 'AN' : 'AUS'), {
size: 80,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.text = buttonText;
// Update button appearance
self.updateAppearance = function () {
self.text.setText('MUSIC: ' + (self.enabled ? 'AN' : 'AUS'));
self.graphics.tint = self.enabled ? 0x90ee90 : 0x666666;
};
self.updateAppearance();
self.down = function () {
if (self.enabled) {
LK.getSound('Started').play();
} else {
LK.getSound('Lever').play();
}
self.enabled = !self.enabled;
self.updateAppearance();
if (self.callback) self.callback(self.enabled);
};
return self;
});
var PalmTree = Container.expand(function () {
var self = Container.call(this);
self.speed = -24;
self.passed = false;
// Create palm tree graphics with standardized size
var palmTreeGraphics = self.attachAsset('palmTree', {
anchorX: 0.5,
anchorY: 1.0,
scaleX: 3.0,
scaleY: 3.0
});
// Store graphics reference
self.palmTreeGraphics = palmTreeGraphics;
// Set standardized obstacle dimensions - 300x400 pixels
self.width = 300;
self.height = 400;
self.update = function () {
self.x += self.speed;
// Add subtle swaying animation
palmTreeGraphics.rotation = Math.sin(LK.ticks * 0.02) * 0.05;
};
return self;
});
var PileOfAsh = Container.expand(function () {
var self = Container.call(this);
// Create pile of ash graphics
var ashGraphics = self.attachAsset('pileOfAsh', {
anchorX: 0.5,
anchorY: 1.0,
scaleX: 2.0,
scaleY: 1.5
});
self.ashGraphics = ashGraphics;
self.creationTime = LK.ticks;
// Set dimensions
self.width = ashGraphics.width;
self.height = ashGraphics.height;
self.update = function () {
// Slowly fade out over time
var timeSinceCreation = LK.ticks - self.creationTime;
if (timeSinceCreation > 180) {
// 3 seconds at 60fps
self.ashGraphics.alpha = Math.max(0, 1 - (timeSinceCreation - 180) / 120);
}
// Add slight wind effect
self.ashGraphics.x += Math.sin(LK.ticks * 0.02) * 0.5;
};
return self;
});
var SkinButton = Container.expand(function (skinType, callback) {
var self = Container.call(this);
var buttonGraphics = self.attachAsset('skinButton', {
anchorX: 0.5,
anchorY: 0.5
});
self.graphics = buttonGraphics;
var skinPreview = self.attachAsset(skinType, {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.6,
scaleY: 0.6
});
self.down = function () {
LK.getSound('Lever').play();
if (callback) callback();
};
return self;
});
var Turtle = Container.expand(function () {
var self = Container.call(this);
self.skinType = 'turtle_default';
self.originalSkin = 'turtle_default';
self.isJumping = false;
self.jumpSpeed = 0;
self.groundY = 0;
self.gravity = 2.4;
self.jumpPower = -90;
self.graphics = null;
self.setSkin = function (skinType) {
if (self.graphics) {
self.removeChild(self.graphics);
}
self.skinType = skinType;
self.originalSkin = skinType;
self.graphics = self.attachAsset(skinType, {
anchorX: 0.5,
anchorY: 1.0
});
// Set the container's dimensions to match the graphics
self.width = self.graphics.width;
self.height = self.graphics.height;
};
self.jump = function () {
if (!self.isJumping) {
self.isJumping = true;
self.jumpSpeed = self.jumpPower;
LK.getSound('jump').play();
// Change skin when jumping
var jumpSkin = self.originalSkin;
if (self.originalSkin === 'turtle_default') {
jumpSkin = 'turtle_jump';
} else if (self.originalSkin === 'turtle_suit') {
jumpSkin = 'turtle_suit_jump';
} else if (self.originalSkin === 'turtle_red') {
jumpSkin = 'turtle_suit_jump';
} else if (self.originalSkin === 'turtle_golden') {
jumpSkin = 'turtle_golden_jump';
}
if (jumpSkin !== self.skinType) {
if (self.graphics) {
self.removeChild(self.graphics);
}
self.skinType = jumpSkin;
self.graphics = self.attachAsset(jumpSkin, {
anchorX: 0.5,
anchorY: 1.0
});
// Set the container's dimensions to match the graphics
self.width = self.graphics.width;
self.height = self.graphics.height;
}
}
};
self.update = function () {
if (self.isJumping) {
self.jumpSpeed += self.gravity;
self.y += self.jumpSpeed;
if (self.y >= self.groundY) {
self.y = self.groundY;
self.isJumping = false;
self.jumpSpeed = 0;
// Play landing sound based on current map
var landingSound = 'Land';
if (currentBackground === 'background_jungle') {
landingSound = 'landing_jungle';
} else if (currentBackground === 'background_volcano') {
landingSound = 'landing_volcano';
} else if (currentBackground === 'background_space') {
landingSound = 'landing_space';
}
LK.getSound(landingSound).play();
// Create dust particles
createDustParticles(self.x, self.y);
// Restore original skin when landing
if (self.skinType !== self.originalSkin) {
if (self.graphics) {
self.removeChild(self.graphics);
}
self.skinType = self.originalSkin;
self.graphics = self.attachAsset(self.originalSkin, {
anchorX: 0.5,
anchorY: 1.0
});
// Set the container's dimensions to match the graphics
self.width = self.graphics.width;
self.height = self.graphics.height;
}
}
}
};
return self;
});
var TurtleBack = Container.expand(function () {
var self = Container.call(this);
self.speed = -24;
self.collected = false;
var backGraphics = self.attachAsset('turtle_back', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2.5,
scaleY: 2.5
});
// Store graphics reference
self.backGraphics = backGraphics;
// Set standardized obstacle dimensions - 300x400 pixels
self.width = 300;
self.height = 400;
self.update = function () {
self.x += self.speed;
// Add floating animation
self.y += Math.sin(LK.ticks * 0.1) * 0.5;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
// Game states
var gameState = 'menu'; // 'menu', 'playing', 'gameOver'
var gamePaused = false; // Controls whether game movement is paused
var darkOverlay = null; // Dark overlay for game over effect
var achievementContainer = null; // Container for achievement notifications
var currentSkin = storage.selectedSkin || 'turtle_default';
var currentLanguage = storage.selectedLanguage || 'English';
var languageMenuContainer = null;
var settingsMenuContainer = null;
var mapMenuContainer = null;
var highscoreWindowContainer = null;
var currentBackground = storage.selectedBackground || 'background_beach';
var backgroundElement = null;
var menuOverlay = null;
// Music settings
var musicEnabled = storage.musicEnabled;
var ambienceEnabled = storage.ambienceEnabled;
var musicVolume = storage.musicVolume || 0.5;
var currentMusicTrack = null;
// Language translations
var translations = {
English: {
title: 'Turtle Run',
play: 'PLAY',
skins: 'SKINS',
back: 'BACK',
chooseSkin: 'Choose Skin',
selectLanguage: 'Select Language',
highScore: 'High Score: '
},
Deutsch: {
title: 'Turtlerun',
play: 'SPIELEN',
skins: 'SKINS',
back: 'ZURÜCK',
chooseSkin: 'Skin auswählen',
selectLanguage: 'Sprache auswählen',
highScore: 'Highscore: '
}
};
// Function to get translated text
function getText(key) {
return translations[currentLanguage][key] || translations['English'][key];
}
// Game elements
var turtle = null;
var palmTrees = [];
var obstacles = [];
var turtleBacks = [];
var ground = null;
var scoreText = null;
var gameScore = 0;
var lastBoulderTime = 0;
var boulderInterval = 200; // milliseconds - much more frequent spawning
var minBoulderInterval = 40; // extremely aggressive minimum interval
var difficultyLevel = 1;
var speedMultiplier = 1.0;
// Menu elements
var menuContainer = null;
var skinMenuContainer = null;
// Use stored background preference
currentBackground = storage.selectedBackground || 'background_beach';
var backgroundScrollSpeed = -12;
var backgroundElements = [];
// Create scrolling background system
function createScrollingBackground() {
// Create two background elements for seamless scrolling
for (var i = 0; i < 2; i++) {
var bg = game.addChild(LK.getAsset('background_beach', {
anchorX: 0,
anchorY: 0,
x: i * 2048,
y: 0
}));
backgroundElements.push(bg);
}
}
// Initialize scrolling background
createScrollingBackground();
// Create menu overlay for better contrast
function createMenuOverlay() {
if (!menuOverlay) {
menuOverlay = game.addChild(LK.getAsset('background_sky', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0,
scaleX: 20.48,
scaleY: 27.32,
alpha: 0.7
}));
}
}
// Create dark overlay for game over effect
function createDarkOverlay() {
if (!darkOverlay) {
darkOverlay = game.addChild(LK.getAsset('background_sky', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0,
scaleX: 20.48,
scaleY: 27.32,
alpha: 0,
tint: 0x000000
}));
// Make sure it's on top of everything except UI
game.setChildIndex(darkOverlay, game.children.length - 1);
}
}
function showMenuOverlay() {
if (menuOverlay) {
menuOverlay.visible = true;
// Ensure overlay is above background but below menu elements
game.setChildIndex(menuOverlay, 2);
}
}
function hideMenuOverlay() {
if (menuOverlay) {
menuOverlay.visible = false;
}
}
// Initialize ground
function createGround() {
var groundAsset = 'ground';
if (currentBackground === 'background_jungle') {
groundAsset = 'ground_jungle';
} else if (currentBackground === 'background_volcano') {
groundAsset = 'ground_volcano';
} else if (currentBackground === 'background_space') {
groundAsset = 'ground_space';
}
return LK.getAsset(groundAsset, {
anchorX: 0,
anchorY: 0,
x: 0,
y: 2732 - 270,
scaleY: 1.5
});
}
ground = game.addChild(createGround());
// Initialize score display
var initialScore = storage.currentScore || 0;
scoreText = new Text2(initialScore.toString(), {
size: 300,
fill: 0xFFFFFF
});
scoreText.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreText);
scoreText.y = 50;
// Set initial color based on saved score
if (initialScore >= 40) {
scoreText.fill = 0xff00ff; // Magenta for 40+
scoreText.tint = 0xff00ff;
} else if (initialScore >= 30) {
scoreText.fill = 0xffd700; // Gold
scoreText.tint = 0xffd700;
} else if (initialScore >= 20) {
scoreText.fill = 0xc0c0c0; // Silver
scoreText.tint = 0xc0c0c0;
} else if (initialScore >= 10) {
scoreText.fill = 0xcd7f32; // Bronze
scoreText.tint = 0xcd7f32;
} else {
scoreText.fill = 0xffffff; // Default white
scoreText.tint = 0xffffff;
}
function createMainMenu() {
createMenuOverlay();
showMenuOverlay();
menuContainer = game.addChild(new Container());
// Title
var titleText = new Text2(getText('title'), {
size: 360,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 2048 / 2;
titleText.y = 800;
// Add black outline effect by creating shadow text
var titleShadow = new Text2(getText('title'), {
size: 360,
fill: 0x000000
});
titleShadow.anchor.set(0.5, 0.5);
titleShadow.x = 2048 / 2 + 4;
titleShadow.y = 800 + 4;
menuContainer.addChild(titleShadow);
menuContainer.addChild(titleText);
// Play button
var playButton = menuContainer.addChild(new MenuButton(getText('play'), function () {
startGame();
}));
playButton.x = 2048 / 2;
playButton.y = 1200;
// Skins button
var skinsButton = menuContainer.addChild(new MenuButton(getText('skins'), function () {
showSkinMenu();
}));
skinsButton.x = 2048 / 2;
skinsButton.y = 1500;
// Map button
var mapButton = menuContainer.addChild(LK.getAsset('mapButton', {
anchorX: 0.5,
anchorY: 0.5
}));
mapButton.x = 2048 / 2 - 200;
mapButton.y = 1800;
mapButton.down = function () {
LK.getSound('Map').play();
showMapMenu();
};
// Highscore button
var highscoreButton = menuContainer.addChild(LK.getAsset('HighscoreButton', {
anchorX: 0.5,
anchorY: 0.5
}));
highscoreButton.x = 2048 / 2 + 200;
highscoreButton.y = 1800;
highscoreButton.down = function () {
LK.getSound('Trophy').play();
showHighscoreWindow();
};
// Gear icon for language selection
var gearIcon = menuContainer.addChild(LK.getAsset('gearIcon', {
anchorX: 0.5,
anchorY: 0.5
}));
gearIcon.x = 2048 - 150;
gearIcon.y = 150;
gearIcon.down = function () {
LK.getSound('Gear').play();
showSettingsMenu();
};
// Show current map display
var currentMapContainer = menuContainer.addChild(new Container());
currentMapContainer.x = 2048 / 2;
currentMapContainer.y = 2300;
// Get current map info
var currentMapName = 'Strand';
if (currentBackground === 'background_jungle') {
currentMapName = 'Dschungel';
} else if (currentBackground === 'background_volcano') {
currentMapName = 'Vulkan';
} else if (currentBackground === 'background_space') {
currentMapName = 'Space';
}
// Current map preview
var currentMapPreview = currentMapContainer.addChild(LK.getAsset(currentBackground, {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.2,
scaleY: 0.16
}));
// Current map name
var currentMapNameText = new Text2(currentMapName, {
size: 60,
fill: 0xFFFFFF
});
currentMapNameText.anchor.set(0.5, 0.5);
currentMapNameText.x = 0;
currentMapNameText.y = 120;
currentMapContainer.addChild(currentMapNameText);
// Highlight current map
currentMapPreview.tint = 0x90ee90;
// High score display
var highScore = storage.highScore || 0;
var highScoreText = new Text2(getText('highScore') + highScore, {
size: 180,
fill: 0xFFFFFF
});
highScoreText.anchor.set(0.5, 0.5);
highScoreText.x = 2048 / 2;
highScoreText.y = 2500;
menuContainer.addChild(highScoreText);
// Turtle decoration removed
}
function showSkinMenu() {
if (menuContainer) {
menuContainer.visible = false;
}
skinMenuContainer = game.addChild(new Container());
// Title
var titleText = new Text2(getText('chooseSkin'), {
size: 240,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 2048 / 2;
titleText.y = 600;
// Add title shadow for better contrast
var titleShadow = new Text2(getText('chooseSkin'), {
size: 240,
fill: 0x000000
});
titleShadow.anchor.set(0.5, 0.5);
titleShadow.x = 2048 / 2 + 3;
titleShadow.y = 600 + 3;
skinMenuContainer.addChild(titleShadow);
skinMenuContainer.addChild(titleText);
// Skin options
var skins = ['turtle_default', 'turtle_red'];
// Add golden turtle if unlocked
if (storage.goldenTurtleUnlocked) {
skins.push('turtle_golden');
}
var startX = 2048 / 2 - 600;
var startY = 900;
for (var i = 0; i < skins.length; i++) {
var skinButton = skinMenuContainer.addChild(new SkinButton(skins[i], function (skin) {
return function () {
currentSkin = skin;
storage.selectedSkin = skin;
hideSkinMenu();
};
}(skins[i])));
skinButton.x = startX + i * 600;
skinButton.y = startY;
// Highlight selected skin
if (skins[i] === currentSkin) {
skinButton.graphics.tint = 0x90ee90;
}
}
// Back button
var backButton = skinMenuContainer.addChild(new MenuButton(getText('back'), function () {
hideSkinMenu();
}));
backButton.x = 2048 / 2;
backButton.y = 1400;
}
function hideSkinMenu() {
if (skinMenuContainer) {
skinMenuContainer.destroy();
skinMenuContainer = null;
}
if (menuContainer) {
menuContainer.visible = true;
}
showMenuOverlay();
}
function showSettingsMenu() {
if (menuContainer) {
menuContainer.visible = false;
}
settingsMenuContainer = game.addChild(new Container());
// Title
var titleText = new Text2('Settings', {
size: 240,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 2048 / 2;
titleText.y = 600;
// Add title shadow for better contrast
var titleShadow = new Text2('Settings', {
size: 240,
fill: 0x000000
});
titleShadow.anchor.set(0.5, 0.5);
titleShadow.x = 2048 / 2 + 3;
titleShadow.y = 600 + 3;
settingsMenuContainer.addChild(titleShadow);
settingsMenuContainer.addChild(titleText);
// Music toggle button
var musicToggle = settingsMenuContainer.addChild(new MusicButton(musicEnabled, function (enabled) {
musicEnabled = enabled;
storage.musicEnabled = enabled;
if (!musicEnabled) {
LK.stopMusic();
currentMusicTrack = null;
} else {
playBackgroundMusic();
}
}));
musicToggle.x = 2048 / 2;
musicToggle.y = 1100;
// Language button
var languageButton = settingsMenuContainer.addChild(new MenuButton(getText('selectLanguage'), function () {
hideSettingsMenu();
showLanguageMenu();
}));
languageButton.x = 2048 / 2;
languageButton.y = 1400;
// Reset button
var resetButton = settingsMenuContainer.addChild(new MenuButton('RESET', function () {
showResetConfirmation();
}));
resetButton.x = 2048 / 2;
resetButton.y = 1700;
// Make reset button red
resetButton.children[0].tint = 0xff0000; // Tint the button graphics red
// Back button
var backButton = settingsMenuContainer.addChild(new MenuButton(getText('back'), function () {
hideSettingsMenu();
}));
backButton.x = 2048 / 2;
backButton.y = 2000;
}
function hideSettingsMenu() {
if (settingsMenuContainer) {
settingsMenuContainer.destroy();
settingsMenuContainer = null;
}
if (menuContainer) {
menuContainer.visible = true;
}
showMenuOverlay();
}
var resetConfirmationContainer = null;
function showResetConfirmation() {
if (settingsMenuContainer) {
settingsMenuContainer.visible = false;
}
LK.getSound('Alarm').play();
resetConfirmationContainer = game.addChild(new Container());
// Title
var titleText = new Text2('Are you sure you want to reset?', {
size: 180,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 2048 / 2;
titleText.y = 1000;
// Add title shadow for better contrast
var titleShadow = new Text2('Are you sure you want to reset?', {
size: 180,
fill: 0x000000
});
titleShadow.anchor.set(0.5, 0.5);
titleShadow.x = 2048 / 2 + 3;
titleShadow.y = 1000 + 3;
resetConfirmationContainer.addChild(titleShadow);
resetConfirmationContainer.addChild(titleText);
// Flash screen red repeatedly
var flashInterval = LK.setInterval(function () {
LK.effects.flashScreen(0xff0000, 200); // Flash red for 200ms
}, 500); // Repeat every 500ms
resetConfirmationContainer.flashInterval = flashInterval; // Store interval ID to clear later
// Yes button
var yesButton = resetConfirmationContainer.addChild(new MenuButton('Confirm Reset', function () {
LK.getSound('Warning').play();
performReset();
hideResetConfirmation();
}));
// Tint the button graphics red
yesButton.children[0].tint = 0xff0000;
yesButton.x = 2048 / 2 - 300;
yesButton.y = 1400;
// No button
var noButton = resetConfirmationContainer.addChild(new MenuButton('NO', function () {
hideResetConfirmation();
}));
noButton.x = 2048 / 2 + 300;
noButton.y = 1400;
}
function hideResetConfirmation() {
if (resetConfirmationContainer) {
if (resetConfirmationContainer.flashInterval) {
LK.clearInterval(resetConfirmationContainer.flashInterval);
}
resetConfirmationContainer.destroy();
resetConfirmationContainer = null;
}
if (settingsMenuContainer) {
settingsMenuContainer.visible = true;
}
}
function performReset() {
// Reset all stored data
storage.highScore = 0;
storage.currentScore = 0;
storage.selectedSkin = 'turtle_default';
storage.selectedBackground = 'background_beach';
storage.selectedLanguage = 'English';
storage.goldenTurtleUnlocked = false;
storage.musicEnabled = false;
storage.ambienceEnabled = true;
// Start reset animation
// First, everything turns red slowly
tween(game, {
tint: 0xff0000
}, {
duration: 1000,
easing: tween.linear,
onFinish: function onFinish() {
// Then everything turns dark slowly
createDarkOverlay();
// Ensure darkOverlay exists before tweening
if (darkOverlay) {
tween(darkOverlay, {
alpha: 1.0
}, {
duration: 1000,
easing: tween.linear,
onFinish: function onFinish() {
// Then everything explodes
// Create an explosion effect (simple particle burst)
for (var i = 0; i < 50; i++) {
var particle = game.addChild(LK.getAsset('sandParticle', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2,
tint: 0xff0000 + Math.random() * 0x00ffff // Random red to yellow tint
}));
var speed = Math.random() * 30 + 10;
var angle = Math.random() * Math.PI * 2;
var velocityX = Math.cos(angle) * speed;
var velocityY = Math.sin(angle) * speed;
var gravity = 1.5;
var lifespan = Math.random() * 60 + 30; // particles last 0.5 to 1 second
particle.update = function () {
this.x += velocityX;
this.y += velocityY;
velocityY += gravity;
this.alpha -= 1 / lifespan;
if (this.alpha <= 0) {
this.destroy();
}
};
}
// Display reset success message
var resetMessage = new Text2(currentLanguage === 'Deutsch' ? 'Speicherdaten erfolgreich gelöscht' : 'Your data has been successfully reset.', {
size: 100,
fill: 0xFFFFFF
});
resetMessage.anchor.set(0.5, 0.5);
resetMessage.x = 2048 / 2;
resetMessage.y = 2732 / 2;
resetMessage.fill = 0xff0000; // Make the text red
game.addChild(resetMessage);
// Play the Memories sound effect when the message appears
LK.getSound('Memories').play();
// Fade out the message after a short delay
tween(resetMessage, {
alpha: 0
}, {
duration: 1500,
delay: 1000,
onFinish: function onFinish() {
resetMessage.destroy();
// After the message fades out, fade the dark overlay to white
if (darkOverlay) {
tween(darkOverlay, {
tint: 0xffffff // Change tint to white
}, {
duration: 1000,
// Duration for fading to white
easing: tween.linear
});
}
}
});
// Reset current game variables after animation
currentSkin = 'turtle_default';
currentBackground = 'background_beach';
currentLanguage = 'English';
musicEnabled = false;
ambienceEnabled = true;
// Reset score display
scoreText.setText('0');
scoreText.fill = 0xffffff;
scoreText.tint = 0xffffff;
// Stop any music
LK.stopMusic();
currentMusicTrack = null;
// Change background to default
changeBackground('background_beach');
// Return to main menu
hideSettingsMenu();
// Reset game tint
game.tint = 0xffffff;
// Clean up dark overlay after explosion
if (darkOverlay) {
// Animate the dark overlay to fade to white
tween(darkOverlay, {
tint: 0xffffff,
alpha: 1.0 // Stay white for a moment
}, {
duration: 1500,
// Duration for fading to white
easing: tween.linear,
onFinish: function onFinish() {
// Stay white for a quarter second, then fade out and clear
LK.setTimeout(function () {
if (darkOverlay) {
tween(darkOverlay, {
alpha: 0.0 // Fade out the alpha as well
}, {
duration: 500,
// Fade out quickly
easing: tween.linear,
onFinish: function onFinish() {
darkOverlay.destroy();
darkOverlay = null;
}
});
}
}, 250); // Stay white for 250ms
}
});
}
}
});
} // Close darkOverlay existence check
}
});
if (menuContainer) {
menuContainer.destroy();
menuContainer = null;
}
createMainMenu();
}
function showLanguageMenu() {
if (menuContainer) {
menuContainer.visible = false;
}
languageMenuContainer = game.addChild(new Container());
// Title
var titleText = new Text2(getText('selectLanguage'), {
size: 240,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 2048 / 2;
titleText.y = 800;
// Add title shadow for better contrast
var titleShadow = new Text2(getText('selectLanguage'), {
size: 240,
fill: 0x000000
});
titleShadow.anchor.set(0.5, 0.5);
titleShadow.x = 2048 / 2 + 3;
titleShadow.y = 800 + 3;
languageMenuContainer.addChild(titleShadow);
languageMenuContainer.addChild(titleText);
// Language options
var languages = ['English', 'Deutsch'];
var startY = 1200;
for (var i = 0; i < languages.length; i++) {
var langButton = languageMenuContainer.addChild(new LanguageButton(languages[i], function (lang) {
return function () {
currentLanguage = lang;
storage.selectedLanguage = lang;
hideLanguageMenu();
// Refresh main menu with new language
if (menuContainer) {
menuContainer.destroy();
menuContainer = null;
}
createMainMenu();
};
}(languages[i])));
langButton.x = 2048 / 2;
langButton.y = startY + i * 300;
// Highlight selected language
if (languages[i] === currentLanguage) {
langButton.graphics.tint = 0x90ee90;
}
}
// Back button
var backButton = languageMenuContainer.addChild(new MenuButton(getText('back'), function () {
hideLanguageMenu();
}));
backButton.x = 2048 / 2;
backButton.y = 2500;
}
function hideLanguageMenu() {
if (languageMenuContainer) {
languageMenuContainer.destroy();
languageMenuContainer = null;
}
showSettingsMenu();
}
function showHighscoreWindow() {
if (menuContainer) {
menuContainer.visible = false;
}
highscoreWindowContainer = game.addChild(new Container());
// Title
var titleText = new Text2('High Score', {
size: 240,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 2048 / 2;
titleText.y = 600;
// Add title shadow for better contrast
var titleShadow = new Text2('High Score', {
size: 240,
fill: 0x000000
});
titleShadow.anchor.set(0.5, 0.5);
titleShadow.x = 2048 / 2 + 3;
titleShadow.y = 600 + 3;
highscoreWindowContainer.addChild(titleShadow);
highscoreWindowContainer.addChild(titleText);
// Get highscore
var highScore = storage.highScore || 0;
if (highScore === 0) {
// No high score yet - show message
var noScoreText = new Text2('No high score yet!', {
size: 180,
fill: 0xFFFFFF
});
noScoreText.anchor.set(0.5, 0.5);
noScoreText.x = 2048 / 2;
noScoreText.y = 1200;
// Add shadow for better visibility
var noScoreShadow = new Text2('No high score yet!', {
size: 180,
fill: 0x000000
});
noScoreShadow.anchor.set(0.5, 0.5);
noScoreShadow.x = 2048 / 2 + 3;
noScoreShadow.y = 1200 + 3;
highscoreWindowContainer.addChild(noScoreShadow);
highscoreWindowContainer.addChild(noScoreText);
} else {
// Show high score with trophy styling
var highScoreText = new Text2(highScore.toString(), {
size: 300,
fill: 0xFFD700
});
highScoreText.anchor.set(0.5, 0.5);
highScoreText.x = 2048 / 2;
highScoreText.y = 1200;
// Add shadow for better visibility
var highScoreShadow = new Text2(highScore.toString(), {
size: 300,
fill: 0x000000
});
highScoreShadow.anchor.set(0.5, 0.5);
highScoreShadow.x = 2048 / 2 + 3;
highScoreShadow.y = 1200 + 3;
highscoreWindowContainer.addChild(highScoreShadow);
highscoreWindowContainer.addChild(highScoreText);
// Add trophy icon or decoration
var trophyText = new Text2('🏆', {
size: 200,
fill: 0xFFD700
});
trophyText.anchor.set(0.5, 0.5);
trophyText.x = 2048 / 2;
trophyText.y = 1000;
highscoreWindowContainer.addChild(trophyText);
}
// Back button
var backButton = highscoreWindowContainer.addChild(new MenuButton(getText('back'), function () {
hideHighscoreWindow();
}));
backButton.x = 2048 / 2;
backButton.y = 1600;
}
function hideHighscoreWindow() {
if (highscoreWindowContainer) {
highscoreWindowContainer.destroy();
highscoreWindowContainer = null;
}
if (menuContainer) {
menuContainer.visible = true;
}
showMenuOverlay();
}
function showMapMenu() {
if (menuContainer) {
menuContainer.visible = false;
}
mapMenuContainer = game.addChild(new Container());
// Title
var titleText = new Text2('Select Map', {
size: 240,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 2048 / 2;
titleText.y = 400;
// Add title shadow for better contrast
var titleShadow = new Text2('Select Map', {
size: 240,
fill: 0x000000
});
titleShadow.anchor.set(0.5, 0.5);
titleShadow.x = 2048 / 2 + 3;
titleShadow.y = 400 + 3;
mapMenuContainer.addChild(titleShadow);
mapMenuContainer.addChild(titleText);
// Map options with background previews
var mapTypes = [{
id: 'background_beach',
name: 'Strand'
}, {
id: 'background_jungle',
name: 'Dschungel'
}, {
id: 'background_volcano',
name: 'Vulkan'
}, {
id: 'background_space',
name: 'Space'
}, {
id: 'background_space',
name: 'Space'
}];
var startX = 2048 / 2 - 600;
var startY = 1000;
var spacing = 300;
for (var i = 0; i < mapTypes.length; i++) {
var mapContainer = mapMenuContainer.addChild(new Container());
mapContainer.x = startX + i * spacing;
mapContainer.y = startY;
// Background preview
var bgPreview = mapContainer.addChild(LK.getAsset(mapTypes[i].id, {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.32,
scaleY: 0.24
}));
// Map name
var mapNameText = new Text2(mapTypes[i].name, {
size: 120,
fill: 0xFFFFFF
});
mapNameText.anchor.set(0.5, 0.5);
mapNameText.x = 0;
mapNameText.y = 200;
// Add text shadow for better contrast
var mapNameShadow = new Text2(mapTypes[i].name, {
size: 120,
fill: 0x000000
});
mapNameShadow.anchor.set(0.5, 0.5);
mapNameShadow.x = 2;
mapNameShadow.y = 202;
mapContainer.addChild(mapNameShadow);
mapContainer.addChild(mapNameText);
// Highlight selected map
if (mapTypes[i].id === currentBackground) {
bgPreview.tint = 0x90ee90;
}
// Make clickable
mapContainer.down = function (mapType) {
return function () {
LK.getSound('Lever').play();
changeBackground(mapType.id);
hideMapMenu();
};
}(mapTypes[i]);
}
// Back button
var backButton = mapMenuContainer.addChild(new MenuButton(getText('back'), function () {
hideMapMenu();
}));
backButton.x = 2048 / 2;
backButton.y = 2400;
}
function hideMapMenu() {
if (mapMenuContainer) {
mapMenuContainer.destroy();
mapMenuContainer = null;
}
if (menuContainer) {
menuContainer.visible = true;
}
showMenuOverlay();
}
function playBackgroundMusic() {
if (!musicEnabled) return;
var musicTrack = null;
if (gameState === 'menu') {
musicTrack = 'Menus';
} else if (gameState === 'playing') {
if (currentBackground === 'background_beach') {
musicTrack = 'Beach';
} else if (currentBackground === 'background_jungle') {
musicTrack = 'Jungle';
} else if (currentBackground === 'background_volcano') {
musicTrack = 'Volcano';
}
}
if (musicTrack && musicTrack !== currentMusicTrack) {
LK.playMusic(musicTrack);
currentMusicTrack = musicTrack;
}
}
function changeBackground(newBackground) {
// Clean up existing background elements
for (var i = 0; i < backgroundElements.length; i++) {
backgroundElements[i].destroy();
}
backgroundElements = [];
currentBackground = newBackground;
storage.selectedBackground = newBackground;
// Recreate scrolling background with new background
for (var i = 0; i < 2; i++) {
var bg = game.addChild(LK.getAsset(currentBackground, {
anchorX: 0,
anchorY: 0,
x: i * 2048,
y: 0
}));
backgroundElements.push(bg);
// Move background to back
game.setChildIndex(bg, 0);
}
// Update ground asset
if (ground) {
ground.destroy();
ground = game.addChild(createGround());
}
// Play appropriate background music only during gameplay
if (gameState === 'playing') {
playBackgroundMusic();
}
}
function startGame() {
gameState = 'playing';
gameScore = 0;
lastBoulderTime = 0;
boulderInterval = 200; // much more frequent spawning
// Use selected background for gameplay
changeBackground(currentBackground);
// Recreate ground with correct asset
if (ground) {
ground.destroy();
ground = game.addChild(createGround());
}
// Hide menu and overlay
if (menuContainer) {
menuContainer.visible = false;
}
hideMenuOverlay();
// Create turtle
turtle = game.addChild(new Turtle());
turtle.setSkin(currentSkin);
turtle.x = 300;
turtle.y = ground.y;
turtle.groundY = ground.y;
// Clean up obstacles
for (var i = obstacles.length - 1; i >= 0; i--) {
obstacles[i].destroy();
}
obstacles = [];
// Clean up palm trees array for backwards compatibility
for (var i = palmTrees.length - 1; i >= 0; i--) {
palmTrees[i].destroy();
}
palmTrees = [];
// Clean up turtle backs
for (var i = turtleBacks.length - 1; i >= 0; i--) {
turtleBacks[i].destroy();
}
turtleBacks = [];
// Clear existing turtle backs
for (var i = turtleBacks.length - 1; i >= 0; i--) {
turtleBacks[i].destroy();
}
turtleBacks = [];
// Save current score and update display with color changes
storage.currentScore = gameScore;
scoreText.setText(gameScore);
// Change score text color based on thresholds
if (gameScore >= 40) {
// Special color for 40+ (rainbow effect using tween)
scoreText.fill = 0xff00ff; // Magenta
tween(scoreText, {
tint: 0x00ffff
}, {
duration: 500,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(scoreText, {
tint: 0xffff00
}, {
duration: 500,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(scoreText, {
tint: 0xff00ff
}, {
duration: 500,
easing: tween.easeInOut
});
}
});
}
});
} else if (gameScore >= 30) {
// Gold
scoreText.fill = 0xffd700;
scoreText.tint = 0xffd700;
} else if (gameScore >= 20) {
// Silver
scoreText.fill = 0xc0c0c0;
scoreText.tint = 0xc0c0c0;
} else if (gameScore >= 10) {
// Bronze
scoreText.fill = 0xcd7f32;
scoreText.tint = 0xcd7f32;
} else {
// Default white
scoreText.fill = 0xffffff;
scoreText.tint = 0xffffff;
}
// Start background music
playBackgroundMusic();
}
function gameOver() {
actualGameOver();
}
function actualGameOver() {
gameState = 'gameOver';
gamePaused = true; // Stop all movement immediately
// Update high score
if (gameScore > (storage.highScore || 0)) {
storage.highScore = gameScore;
}
// Note: Specific hit sounds are now played on collision detection
// Flash screen red
LK.effects.flashScreen(0xff0000, 500);
// Create dark overlay and animate it
createDarkOverlay();
tween(darkOverlay, {
alpha: 1.0
}, {
duration: 1000,
easing: tween.easeInOut
});
// Show game over after delay - wait for hit sound to complete
LK.setTimeout(function () {
LK.showGameOver('Score: ' + gameScore);
// Reset everything after game over is shown
resetGame();
}, 1500);
}
function resetGame() {
gameState = 'menu';
gamePaused = false; // Reset pause state
// Keep dark overlay - don't clean it up until retry is pressed
// if (darkOverlay) {
// darkOverlay.destroy();
// darkOverlay = null;
// }
// Stop background music when leaving gameplay
LK.stopMusic();
currentMusicTrack = null;
// Reset game variables
gameScore = 0;
lastBoulderTime = 0;
boulderInterval = 200;
difficultyLevel = 1;
speedMultiplier = 1.0;
// Clean up turtle
if (turtle) {
turtle.destroy();
turtle = null;
}
// Clean up obstacles
for (var i = obstacles.length - 1; i >= 0; i--) {
obstacles[i].destroy();
}
obstacles = [];
// Clean up palm trees array for backwards compatibility
for (var i = palmTrees.length - 1; i >= 0; i--) {
palmTrees[i].destroy();
}
palmTrees = [];
// Reset score display and color
scoreText.setText('0');
scoreText.fill = 0xffffff; // Reset to white
scoreText.tint = 0xffffff;
// Stop any ongoing color tweens
tween.stop(scoreText, {
tint: true
});
// Show menu
if (menuContainer) {
menuContainer.visible = true;
showMenuOverlay();
} else {
createMainMenu();
}
// Play menu music when returning to menu
playBackgroundMusic();
}
function showAchievementNotification(message) {
// Create achievement container if it doesn't exist
if (achievementContainer) {
achievementContainer.destroy();
}
achievementContainer = game.addChild(new Container());
// Create white text box background
var textBox = achievementContainer.addChild(LK.getAsset('background_sky', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 15,
scaleY: 2,
tint: 0xffffff,
alpha: 0.9
}));
// Create achievement text
var achievementText = new Text2(message, {
size: 120,
fill: 0x000000
});
achievementText.anchor.set(0.5, 0.5);
achievementContainer.addChild(achievementText);
// Position at bottom of screen initially
achievementContainer.x = 2048 / 2;
achievementContainer.y = 2732 + 100; // Start below screen
// Animation sequence: fly up to bottom, stay briefly, then fly down
tween(achievementContainer, {
y: 2732 - 200 // Fly to bottom area of screen
}, {
duration: 800,
easing: tween.easeOut,
onFinish: function onFinish() {
// Stay at bottom for a moment
tween(achievementContainer, {
y: 2732 - 200 // Stay in place
}, {
duration: 1500,
onFinish: function onFinish() {
// Fly back down off screen
tween(achievementContainer, {
y: 2732 + 100
}, {
duration: 800,
easing: tween.easeIn,
onFinish: function onFinish() {
if (achievementContainer) {
achievementContainer.destroy();
achievementContainer = null;
}
}
});
}
});
}
});
}
function createDustParticles(x, y) {
for (var i = 0; i < 8; i++) {
var particle = game.addChild(LK.getAsset('sandParticle', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.5 + Math.random() * 0.8,
scaleY: 0.5 + Math.random() * 0.8,
x: x + (Math.random() - 0.5) * 120,
y: y - 10,
alpha: 0.8
}));
// Create flying sand effect with arc trajectory
var targetY = y - Math.random() * 150 - 80;
var targetX = particle.x + (Math.random() - 0.5) * 200;
var midY = y - Math.random() * 80 - 40;
// First phase: launch upward with arc
tween(particle, {
y: midY,
x: targetX * 0.6,
alpha: 0.9
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
// Second phase: fall down with gravity
tween(particle, {
y: targetY,
x: targetX,
alpha: 0
}, {
duration: 600,
easing: tween.easeIn,
onFinish: function onFinish() {
particle.destroy();
}
});
}
});
}
}
// Touch input for jumping
game.down = function (x, y, obj) {
if (gameState === 'playing' && turtle) {
turtle.jump();
}
};
// Handle retry button press to clear dark overlay
LK.on('retry', function () {
// Clear dark overlay when retry is pressed
if (darkOverlay) {
darkOverlay.destroy();
darkOverlay = null;
}
});
// Main game loop
game.update = function () {
// Don't update anything if game is paused
if (gamePaused) return;
// Update scrolling background only when playing
if (gameState === 'playing') {
for (var i = 0; i < backgroundElements.length; i++) {
var bg = backgroundElements[i];
bg.x += backgroundScrollSpeed;
// Reset position when background moves off screen
if (bg.x <= -2048) {
// Find the other background element and position relative to it
var otherBg = backgroundElements[1 - i];
bg.x = otherBg.x + 2048;
}
}
}
if (gameState === 'playing') {
// Spawn obstacles based on current map
if (LK.ticks - lastBoulderTime > boulderInterval) {
var obstacle = null;
if (currentBackground === 'background_beach') {
obstacle = game.addChild(new PalmTree());
} else if (currentBackground === 'background_jungle') {
obstacle = game.addChild(new PalmTree());
} else if (currentBackground === 'background_volcano') {
obstacle = game.addChild(new LavaGeyser());
} else if (currentBackground === 'background_space') {
obstacle = game.addChild(new LaserWall());
}
if (obstacle) {
obstacle.x = 2048 + 300; // Spawn further off-screen to hide spawning
obstacle.y = ground.y;
obstacle.speed = obstacle.speed * speedMultiplier; // Apply speed multiplier
obstacles.push(obstacle);
}
lastBoulderTime = LK.ticks;
// Progressive difficulty system with speed cap
var newDifficultyLevel = Math.floor(gameScore / 5) + 1;
if (newDifficultyLevel > difficultyLevel) {
difficultyLevel = newDifficultyLevel;
// Cap speed multiplier at 2.0x for playability
speedMultiplier = Math.min(2.0, 1.0 + (difficultyLevel - 1) * 0.2); // 20% speed increase per level, capped at 2x
// Play celebrate sound when speed increases
LK.getSound('celebrate').play();
}
// Increase spawn rate more moderately
if (boulderInterval > minBoulderInterval) {
var reduction = Math.max(5, Math.floor(difficultyLevel * 2)); // More moderate reduction
boulderInterval = Math.max(minBoulderInterval, boulderInterval - reduction);
}
}
// Update obstacles and check collisions
for (var i = obstacles.length - 1; i >= 0; i--) {
var obstacle = obstacles[i];
// Remove off-screen obstacles (hide despawning)
if (obstacle.x < -300) {
obstacle.destroy();
obstacles.splice(i, 1);
continue;
}
// Check if obstacle was passed for scoring
if (!obstacle.passed && obstacle.x < turtle.x) {
obstacle.passed = true;
gameScore++;
// Save current score and update display with color changes
storage.currentScore = gameScore;
scoreText.setText(gameScore);
// Change score text color based on thresholds
if (gameScore >= 40) {
// Special color for 40+ (rainbow effect using tween)
scoreText.fill = 0xff00ff; // Magenta
tween(scoreText, {
tint: 0x00ffff
}, {
duration: 500,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(scoreText, {
tint: 0xffff00
}, {
duration: 500,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(scoreText, {
tint: 0xff00ff
}, {
duration: 500,
easing: tween.easeInOut
});
}
});
}
});
// Play special trophy sound for reaching 40 if this is the first time
if (gameScore == 40 && (storage.highScore || 0) < 40) {
LK.getSound('trophy_gold').play();
showAchievementNotification("You've achieved Master Rank!");
}
} else if (gameScore >= 30) {
// Gold
scoreText.fill = 0xffd700;
scoreText.tint = 0xffd700;
// Play gold trophy sound for reaching 30 if this is the first time
if (gameScore == 30 && (storage.highScore || 0) < 30) {
LK.getSound('trophy_gold').play();
// Unlock golden turtle skin permanently
storage.goldenTurtleUnlocked = true;
// Flash screen golden and pause game briefly
LK.effects.flashScreen(0xffd700, 1000);
// Show achievement notification
showAchievementNotification("You've achieved Gold Rank!");
// Pause game for 1 second
var gameWasPaused = false;
LK.setTimeout(function () {
gameWasPaused = true;
}, 1000);
}
} else if (gameScore >= 20) {
// Silver
scoreText.fill = 0xc0c0c0;
scoreText.tint = 0xc0c0c0;
// Play silver trophy sound for reaching 20 if this is the first time
if (gameScore == 20 && (storage.highScore || 0) < 20) {
LK.getSound('trophy_silver').play();
showAchievementNotification("You've achieved Silver Rank!");
}
} else if (gameScore >= 10) {
// Bronze
scoreText.fill = 0xcd7f32;
scoreText.tint = 0xcd7f32;
// Play bronze trophy sound for reaching 10 if this is the first time
if (gameScore == 10 && (storage.highScore || 0) < 10) {
LK.getSound('trophy_bronze').play();
showAchievementNotification("You've achieved Bronze Rank!");
}
} else {
// Default white
scoreText.fill = 0xffffff;
scoreText.tint = 0xffffff;
}
// Play celebration sound for scoring
LK.getSound('Secret').play();
}
// Check collision with turtle
if (turtle && turtle.intersects(obstacle)) {
// Play specific hit sound based on obstacle type
if (obstacle instanceof PalmTree) {
LK.getSound('hit_palm_tree').play();
} else if (obstacle instanceof LavaGeyser) {
LK.getSound('hit_lava_geyser').play();
// Create pile of ash at turtle's position
var ash = game.addChild(new PileOfAsh());
ash.x = turtle.x;
ash.y = turtle.y;
// Hide the turtle
turtle.visible = false;
} else if (obstacle instanceof LaserWall) {
LK.getSound('hit_laser_wall').play();
}
gameOver();
return;
}
}
}
};
// Initialize main menu
createMainMenu();
// Initialize background music
playBackgroundMusic(); ===================================================================
--- original.js
+++ change.js
@@ -1167,10 +1167,13 @@
name: 'Vulkan'
}, {
id: 'background_space',
name: 'Space'
+ }, {
+ id: 'background_space',
+ name: 'Space'
}];
- var startX = 2048 / 2 - 450;
+ var startX = 2048 / 2 - 600;
var startY = 1000;
var spacing = 300;
for (var i = 0; i < mapTypes.length; i++) {
var mapContainer = mapMenuContainer.addChild(new Container());
The sand ground of some sort of beach. In-Game asset. 2d. High contrast. No shadows
A small world map. In-Game asset. 2d. High contrast. No shadows
I land turtle with googly eyes wearing a suit and looking to the right. In-Game asset. 2d. High contrast. No shadows
Irregular old land turtle wearing a suit with a red tie in a jumping position. In-Game asset. 2d. High contrast. No shadows
A settings button I can without any background it’s a gear. In-Game asset. 2d. High contrast. No shadows
The beach of a tropical island, though the ocean is not to be seen in the background there is just a vibrant jungle. In-Game asset. 2d. High contrast. No shadows
A lush and vibrant jungle. In-Game asset. 2d. High contrast. No shadows
A area filled with lava and a sky two it’s still pretty vibrant but make sure it can loop without looking bad. In-Game asset. 2d. High contrast. No shadows
Junglee grass ground which is a bit overgrown. In-Game asset. 2d. High contrast. No shadows
Volcanic rocks for a ground. In-Game asset. 2d. High contrast. No shadows
I completely dark red square with some orange parts more in the middle representing a lava block. In-Game asset. 2d. High contrast. No shadows
A crazy almost neon green plant that can grow both on in the jungles and on beaches. In-Game asset. 2d. High contrast. No shadows
A golden land turtle with googly eyes looking to the right. In-Game asset. 2d. High contrast. No shadows
A golden turtle with googly eyes in the jumping position. In-Game asset. 2d. High contrast. No shadows
A pile of burn ash. In-Game asset. 2d. High contrast. No shadows
A trophy without any background. In-Game asset. 2d. High contrast. No shadows
A sterile space station background But it’s still futuristic and definitely seems like it’s made out of metal. In-Game asset. 2d. High contrast. No shadows
A metal plate working as the ground for a space station. In-Game asset. 2d. High contrast. No shadows
A swampy background with mangrove trees and overall overgrown but lush aesthetics. In-Game asset. 2d. High contrast. No shadows
A muddy swamp ground. In-Game asset. 2d. High contrast. No shadows
A background, this picture of a flash eating plant Not eating flesh at least not yet. In-Game asset. 2d. High contrast. No shadows
The street ground of a city. In-Game asset. 2d. High contrast. No shadows
A white car. In-Game asset. 2d. High contrast. No shadows
The skyline of a modern city. In-Game asset. 2d. High contrast. No shadows
Evening image of a mountain range easily looping. In-Game asset. 2d. High contrast. No shadows
The tropical ocean with the shore of an island in the far background easily looping itself. In-Game asset. 2d. High contrast. No shadows
A pirate. In-Game asset. 2d. High contrast. No shadows
The wooden floor of a pirate ship. In-Game asset. 2d. High contrast. No shadows
The pillar of an ancient jungle temple. In-Game asset. 2d. High contrast. No shadows
Ancient trap able to dispense arrows to PS it’s target. In-Game asset. 2d. High contrast. No shadows
The ground for an ancient jungle temple. In-Game asset. 2d. High contrast. No shadows
The background for the inside of an ancient jungle temple. In-Game asset. 2d. High contrast. No shadows
Fully soaked and wet grass and the dirt for the ground element oven to the jump and run. In-Game asset. 2d. High contrast. No shadows
Just a tree. In-Game asset. 2d. High contrast. No shadows
An open space of grass with dark rainy clouds up above Easily looper. In-Game asset. 2d. High contrast. No shadows
hit
Sound effect
jump
Sound effect
Map
Sound effect
Lever
Sound effect
Gear
Sound effect
Land
Sound effect
Secret
Sound effect
celebrate
Sound effect
Started
Sound effect
landing_jungle
Sound effect
landing_volcano
Sound effect
hit_lava_geyser
Sound effect
hit_palm_tree
Sound effect
trophy_bronze
Sound effect
trophy_gold
Sound effect
trophy_silver
Sound effect
Beach
Music
Jungle
Music
Volcano
Music
Warning
Sound effect
Alarm
Sound effect
Memories
Sound effect
Trophy
Sound effect
hit_laser_wall
Sound effect
Space
Music
landing_space
Sound effect
landing_swamp
Sound effect
hit_carnivorous_plant
Sound effect
Swamp
Music
City
Music
hit_car
Sound effect
landing_city
Sound effect
landing_silhouette_mountain
Sound effect
hit_dripstone
Sound effect
hit_pirate
Sound effect
pirate_landing
Sound effect
hit_arrow_trap
Sound effect
landing_ancient_temple
Sound effect
landing_thunderplanes
Sound effect
hit_thundertree
Sound effect
Thunderplanes
Music
thunder
Sound effect