User prompt
Make it so that the beach map in German is called Strand, the jungle map in German is called Dschungel, and the volcano map in English is called Vulkan, I mean in German it's called Vulkan.
User prompt
Make sure that the obstacles are better visible.
User prompt
create two new hit sounds. Hit lava geyser and hit palm tree and make them play only if the player dies by a palm tree or the player dies by a lava geyser respectively.
User prompt
sure that all obstacles are the same size and they are the same size and as their textures also use the palm tree obstacle on jungle map and the lava geyser obstacle on well
User prompt
create two new ground assets ground jungle and ground volcano also add new well two new sounds landing jungle and landing volcano
User prompt
Make sure that all three maps are able to be selected in the map selector. Also, add the new palm tree obstacle and add the jungle to the map selector. And make sure, if a new map is selected, also the background changes.
User prompt
Make the menu stark and the background and other elements, game elements a bit, so it's easier to recognize everything.
User prompt
create two new obstacle assets create the palm tree obstacle and the lava geyser
User prompt
Make it so, when pressing the map button, the player can choose between beach, jungle and volcano. Also, their backgrounds will be shown above their names. Change to set background.
User prompt
Make the background not move when in a menu.
User prompt
Create three new music tracks, Beach Ambience, Jungle Ambience and Volcano Ambience.
User prompt
Make it so that the player cannot see the gap between the background scrollings. Also, re-add the map button below, well, the skins button.
User prompt
Change the name of the boulder obstacle to Palm Tree.
User prompt
Make it so that the player cannot see, well, the elements spawning and despawning. Also, make it so that background beach is used for the currently only level. And make it so it scrolls and before the player can see it. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
create three different backgrounds making them all vertical rectangles well, background beach, background jungle, background volcano
User prompt
add the toggle music below German as a language in the settings so add music and make it be turned off on standard if it's turned on play the sound effect started ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
If the button music is pressed, well, re-add the button music at first, and then, if it's turned on, play the sound started. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Remove the slider from existence. Also, if the music button is turned on, make the sound started play. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Make the music button appear below the setting for German. Also, make the music button have a different background and make it only appear in the settings.
User prompt
make the toggle for music appear in the settings in the top right of the screen where you can already change the language and not in the main main menu ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Add a music button to the settings, and if that button, well, make it a switch, and if the switch is toggled on, also add a slider for the volume of the music. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
use the sound asset celebrate if the play with the speed of the game gets faster
User prompt
Actually, use the sound CELEBRATE when the score goes up.
User prompt
Use the sound up if the score goes well up.
User prompt
Remove assistance mode again and delete everything associated with it.
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* 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 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 shadow effect first
var geyserShadow = self.attachAsset('lavaGeyser', {
anchorX: 0.5,
anchorY: 1.0,
scaleX: 1.4,
scaleY: 1.4
});
geyserShadow.tint = 0x000000;
geyserShadow.alpha = 0.4;
geyserShadow.x = 6;
geyserShadow.y = 6;
var geyserGraphics = self.attachAsset('lavaGeyser', {
anchorX: 0.5,
anchorY: 1.0,
scaleX: 1.4,
scaleY: 1.4
});
// Set the container's dimensions to match the scaled graphics
self.width = geyserGraphics.width * 1.4;
self.height = geyserGraphics.height * 1.4;
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
geyserGraphics.tint = 0xff2222;
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
geyserGraphics.tint = 0xdddddd;
geyserGraphics.alpha = 1.0;
}
// Add slight vertical movement when erupting
if (self.isErupting) {
self.y += Math.sin(LK.ticks * 0.3) * 3;
geyserShadow.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 MusicToggleButton = 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 ? 'ON' : 'OFF'), {
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 ? 'ON' : 'OFF'));
self.graphics.tint = self.enabled ? 0x90ee90 : 0x666666;
};
self.updateAppearance();
self.down = function () {
LK.getSound('Lever').play();
self.enabled = !self.enabled;
self.updateAppearance();
if (self.callback) self.callback(self.enabled);
// Play Started sound when music is enabled
if (self.enabled) {
LK.getSound('Started').play();
}
};
return self;
});
var PalmTree = Container.expand(function () {
var self = Container.call(this);
self.speed = -24;
self.passed = false;
// Create shadow effect first
var palmTreeShadow = self.attachAsset('palmTree', {
anchorX: 0.5,
anchorY: 1.0,
scaleX: 1.4,
scaleY: 1.4
});
palmTreeShadow.tint = 0x000000;
palmTreeShadow.alpha = 0.5;
palmTreeShadow.x = 5;
palmTreeShadow.y = 5;
var palmTreeGraphics = self.attachAsset('palmTree', {
anchorX: 0.5,
anchorY: 1.0,
scaleX: 1.4,
scaleY: 1.4
});
// Add outline effect with slight tint
palmTreeGraphics.tint = 0xdddddd;
// Set the container's dimensions to match the scaled graphics
self.width = palmTreeGraphics.width * 1.4;
self.height = palmTreeGraphics.height * 1.4;
self.update = function () {
self.x += self.speed;
// Add subtle swaying animation
palmTreeGraphics.rotation = Math.sin(LK.ticks * 0.02) * 0.05;
palmTreeShadow.rotation = Math.sin(LK.ticks * 0.02) * 0.05;
};
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';
}
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';
}
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: 1.2,
scaleY: 1.2
});
// Set the container's dimensions to match the scaled graphics
self.width = backGraphics.width * 1.2;
self.height = backGraphics.height * 1.2;
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 currentSkin = storage.selectedSkin || 'turtle_default';
var currentLanguage = storage.selectedLanguage || 'English';
var languageMenuContainer = null;
var settingsMenuContainer = null;
var mapMenuContainer = null;
var currentBackground = storage.selectedBackground || 'background_beach';
var backgroundElement = null;
var menuOverlay = null;
// Music settings
var musicEnabled = storage.musicEnabled !== undefined ? storage.musicEnabled : false;
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 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
}));
}
}
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';
}
return LK.getAsset(groundAsset, {
anchorX: 0,
anchorY: 0,
x: 0,
y: 2732 - 270
});
}
ground = game.addChild(createGround());
// Initialize score display
scoreText = new Text2('0', {
size: 300,
fill: 0xFFFFFF
});
scoreText.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreText);
scoreText.y = 50;
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;
mapButton.y = 1800;
mapButton.down = function () {
LK.getSound('Map').play();
showMapMenu();
};
// 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();
showLanguageMenu();
};
// 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 = 2400;
menuContainer.addChild(highScoreText);
}
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'];
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 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;
}
}
// Music toggle button (below German language setting)
var musicToggle = languageMenuContainer.addChild(new MusicToggleButton(musicEnabled, function (enabled) {
musicEnabled = enabled;
storage.musicEnabled = enabled;
if (musicEnabled) {
playBackgroundMusic();
} else {
LK.stopMusic();
currentMusicTrack = null;
}
}));
musicToggle.x = 2048 / 2;
musicToggle.y = startY + languages.length * 300;
// Background selection buttons
var backgroundTypes = ['background_beach', 'background_jungle', 'background_volcano'];
var backgroundNames = ['Beach', 'Jungle', 'Volcano'];
var backgroundStartY = startY + languages.length * 300 + 200;
for (var i = 0; i < backgroundTypes.length; i++) {
var bgButton = languageMenuContainer.addChild(new LanguageButton(backgroundNames[i], function (bgType) {
return function () {
changeBackground(bgType);
LK.getSound('Lever').play();
};
}(backgroundTypes[i])));
bgButton.x = 2048 / 2;
bgButton.y = backgroundStartY + i * 150;
// Highlight selected background
if (backgroundTypes[i] === currentBackground) {
bgButton.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;
}
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'
}];
var startY = 800;
var spacing = 500;
for (var i = 0; i < mapTypes.length; i++) {
var mapContainer = mapMenuContainer.addChild(new Container());
mapContainer.x = 2048 / 2;
mapContainer.y = startY + i * spacing;
// Background preview
var bgPreview = mapContainer.addChild(LK.getAsset(mapTypes[i].id, {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.3,
scaleY: 0.2
}));
// 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 (currentBackground === 'background_beach') {
musicTrack = 'beachAmbience';
} else if (currentBackground === 'background_jungle') {
musicTrack = 'jungleAmbience';
} else if (currentBackground === 'background_volcano') {
musicTrack = 'volcanoAmbience';
}
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
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 palm trees
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 = [];
// Update score display
scoreText.setText(gameScore);
// Start background music
playBackgroundMusic();
}
function gameOver() {
actualGameOver();
}
function actualGameOver() {
gameState = 'gameOver';
// 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);
// Show game over after delay
LK.setTimeout(function () {
LK.showGameOver();
// Reset everything after game over is shown
resetGame();
}, 500);
}
function resetGame() {
gameState = 'menu';
// 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 palm trees
for (var i = palmTrees.length - 1; i >= 0; i--) {
palmTrees[i].destroy();
}
palmTrees = [];
// Reset score display
scoreText.setText('0');
// Show menu
if (menuContainer) {
menuContainer.visible = true;
showMenuOverlay();
} else {
createMainMenu();
}
}
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();
}
};
// Main game loop
game.update = function () {
// 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());
}
if (obstacle) {
obstacle.x = 2048 + 300; // Spawn further off-screen to hide spawning
obstacle.y = ground.y + 90;
obstacle.speed = obstacle.speed * speedMultiplier; // Apply speed multiplier
palmTrees.push(obstacle);
}
lastBoulderTime = LK.ticks;
// Progressive difficulty system
var newDifficultyLevel = Math.floor(gameScore / 5) + 1;
if (newDifficultyLevel > difficultyLevel) {
difficultyLevel = newDifficultyLevel;
speedMultiplier = 1.0 + (difficultyLevel - 1) * 0.3; // 30% speed increase per level
// Play celebrate sound when speed increases
LK.getSound('celebrate').play();
}
// Increase spawn rate more aggressively
if (boulderInterval > minBoulderInterval) {
var reduction = Math.max(8, Math.floor(difficultyLevel * 3)); // More aggressive reduction
boulderInterval -= reduction;
}
}
// Update palm trees and check collisions
for (var i = palmTrees.length - 1; i >= 0; i--) {
var palmTree = palmTrees[i];
// Remove off-screen palm trees (hide despawning)
if (palmTree.x < -300) {
palmTree.destroy();
palmTrees.splice(i, 1);
continue;
}
// Check if palm tree was passed for scoring
if (!palmTree.passed && palmTree.x < turtle.x) {
palmTree.passed = true;
gameScore++;
scoreText.setText(gameScore);
// Play celebration sound for scoring
LK.getSound('Secret').play();
}
// Check collision with turtle
if (turtle && turtle.intersects(palmTree)) {
// Play specific hit sound based on obstacle type
if (palmTree instanceof PalmTree) {
LK.getSound('hit_palm_tree').play();
} else if (palmTree instanceof LavaGeyser) {
LK.getSound('hit_lava_geyser').play();
}
gameOver();
return;
}
}
}
};
// Initialize main menu
createMainMenu();
// Initialize background music
playBackgroundMusic(); ===================================================================
--- original.js
+++ change.js
@@ -676,15 +676,15 @@
mapMenuContainer.addChild(titleText);
// Map options with background previews
var mapTypes = [{
id: 'background_beach',
- name: 'Beach'
+ name: 'Strand'
}, {
id: 'background_jungle',
- name: 'Jungle'
+ name: 'Dschungel'
}, {
id: 'background_volcano',
- name: 'Volcano'
+ name: 'Vulkan'
}];
var startY = 800;
var spacing = 500;
for (var i = 0; i < mapTypes.length; i++) {
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