User prompt
Change the place that says Coin to a symbol
User prompt
Move the place that says Coin to the upper middle part
User prompt
Make the floor animated βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Background, endless, image
User prompt
Increases coins
User prompt
When you click on settings, there will be sound settings βͺπ‘ Consider importing and using the following plugins: @upit/storage.v1
User prompt
Add a start screen to the game, press the button to play, and go to settings to adjust the sound. βͺπ‘ Consider importing and using the following plugins: @upit/storage.v1
User prompt
Slightly increase the size of everything on the screen βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make the character an animated fox βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Clear all obstacles
User prompt
Delete the mountain and forest in the background
User prompt
Let the character appear in the foreground
User prompt
Make a mountain and a grassy forest and make it animated βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
As the ground character progresses, it progresses with it.
User prompt
When the character jumps, leave a small trail behind βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Let the character jump a little more 2 units
User prompt
The more you press on the screen, the higher the character jumps.
User prompt
Adjust the randomness of obstacles proportionally
User prompt
Adjust the size of your character enough to jump over obstacles
User prompt
Replace the number of lives on the screen with 3 hearts
User prompt
Give the character the right to life and give it 3 lives
User prompt
Make the character's hitbox round
User prompt
Make the obstacle locations a little more random
User prompt
Convert the obstacle model to the thorn model
Code edit (1 edits merged)
Please save this source code
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1", {
soundEnabled: true
});
/****
* Classes
****/
var Coin = Container.expand(function () {
var self = Container.call(this);
var coinGraphics = self.attachAsset('coin', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = gameSpeed;
self.collected = false;
// Floating animation
self.floatOffset = 0;
self.update = function () {
self.x -= self.speed;
// Floating animation
self.floatOffset += 0.15;
coinGraphics.y = Math.sin(self.floatOffset) * 10;
// Rotation animation
coinGraphics.rotation += 0.1;
};
return self;
});
var Player = Container.expand(function () {
var self = Container.call(this);
var foxGraphics = self.attachAsset('fox', {
anchorX: 0.5,
anchorY: 1.0
});
self.isJumping = false;
self.velocityY = 0;
self.groundY = 2732 - 250; // Ground level
self.jumpPower = -27;
self.gravity = 1.2;
self.runAnimationTimer = 0;
self.jump = function () {
if (!self.isJumping) {
self.isJumping = true;
self.velocityY = self.jumpPower;
if (storage.soundEnabled) {
LK.getSound('jump').play();
}
// Jump animation - scale up and rotate slightly
tween(foxGraphics, {
scaleX: 1.2,
scaleY: 1.2,
rotation: -0.3
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(foxGraphics, {
scaleX: 1.0,
scaleY: 1.0,
rotation: 0
}, {
duration: 300,
easing: tween.easeIn
});
}
});
}
};
self.update = function () {
if (self.isJumping) {
self.velocityY += self.gravity;
self.y += self.velocityY;
// Land on ground
if (self.y >= self.groundY) {
self.y = self.groundY;
self.isJumping = false;
self.velocityY = 0;
}
} else {
// Running animation when on ground
self.runAnimationTimer += 0.2;
foxGraphics.y = Math.sin(self.runAnimationTimer) * 3;
foxGraphics.scaleX = 1.0 + Math.sin(self.runAnimationTimer * 2) * 0.05;
}
};
return self;
});
var SettingsScreen = Container.expand(function () {
var self = Container.call(this);
// Settings title
var titleText = new Text2('SETTINGS', {
size: 120,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 2048 / 2;
titleText.y = 800;
self.addChild(titleText);
// Sound settings section
var soundSectionText = new Text2('SOUND SETTINGS', {
size: 90,
fill: 0xFFD700
});
soundSectionText.anchor.set(0.5, 0.5);
soundSectionText.x = 2048 / 2;
soundSectionText.y = 1050;
self.addChild(soundSectionText);
// Sound toggle button
var soundButton = LK.getAsset('coin', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 1300,
scaleX: 5,
scaleY: 2
});
// Color the button based on sound state
soundButton.tint = storage.soundEnabled ? 0x00FF00 : 0xFF0000;
self.addChild(soundButton);
// Sound toggle text
var soundText = new Text2(storage.soundEnabled ? 'SOUND: ON' : 'SOUND: OFF', {
size: 70,
fill: 0x000000
});
soundText.anchor.set(0.5, 0.5);
soundText.x = 2048 / 2;
soundText.y = 1300;
self.addChild(soundText);
// Sound description
var soundDescText = new Text2('Toggle game sound effects', {
size: 50,
fill: 0xCCCCCC
});
soundDescText.anchor.set(0.5, 0.5);
soundDescText.x = 2048 / 2;
soundDescText.y = 1450;
self.addChild(soundDescText);
// Back button
var backButton = LK.getAsset('coin', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 1700,
scaleX: 2.5,
scaleY: 2.5
});
self.addChild(backButton);
var backText = new Text2('BACK', {
size: 60,
fill: 0x000000
});
backText.anchor.set(0.5, 0.5);
backText.x = 2048 / 2;
backText.y = 1700;
self.addChild(backText);
self.down = function (x, y, obj) {
var localPos = self.toLocal(obj.parent.toGlobal(obj.position));
// Check sound button - larger hit area for better mobile interaction
if (Math.abs(localPos.x - 2048 / 2) < 250 && Math.abs(localPos.y - 1300) < 100) {
storage.soundEnabled = !storage.soundEnabled;
soundText.setText(storage.soundEnabled ? 'SOUND: ON' : 'SOUND: OFF');
// Update button color
soundButton.tint = storage.soundEnabled ? 0x00FF00 : 0xFF0000;
// Visual feedback
LK.effects.flashObject(soundButton, 0xFFFFFF, 200);
// Play test sound if enabled
if (storage.soundEnabled) {
LK.getSound('coin').play();
}
}
// Check back button
if (Math.abs(localPos.x - 2048 / 2) < 120 && Math.abs(localPos.y - 1700) < 70) {
showStartScreen();
}
};
return self;
});
var StartScreen = Container.expand(function () {
var self = Container.call(this);
// Title text
var titleText = new Text2('FOX RUNNER', {
size: 150,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 2048 / 2;
titleText.y = 800;
self.addChild(titleText);
// Play button
var playButton = LK.getAsset('coin', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 1400,
scaleX: 3,
scaleY: 3
});
self.addChild(playButton);
var playText = new Text2('PLAY', {
size: 80,
fill: 0x000000
});
playText.anchor.set(0.5, 0.5);
playText.x = 2048 / 2;
playText.y = 1400;
self.addChild(playText);
// Settings button
var settingsButton = LK.getAsset('coin', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 1700,
scaleX: 2.5,
scaleY: 2.5
});
self.addChild(settingsButton);
var settingsText = new Text2('SETTINGS', {
size: 60,
fill: 0x000000
});
settingsText.anchor.set(0.5, 0.5);
settingsText.x = 2048 / 2;
settingsText.y = 1700;
self.addChild(settingsText);
self.down = function (x, y, obj) {
var localPos = self.toLocal(obj.parent.toGlobal(obj.position));
// Check play button
if (Math.abs(localPos.x - 2048 / 2) < 150 && Math.abs(localPos.y - 1400) < 80) {
startGame();
}
// Check settings button
if (Math.abs(localPos.x - 2048 / 2) < 120 && Math.abs(localPos.y - 1700) < 70) {
showSettings();
}
};
return self;
});
var Trail = Container.expand(function () {
var self = Container.call(this);
var trailGraphics = self.attachAsset('fox', {
anchorX: 0.5,
anchorY: 1.0,
scaleX: 0.6,
scaleY: 0.6,
alpha: 0.7
});
self.speed = gameSpeed;
self.update = function () {
self.x -= self.speed;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
var gameState = 'start'; // 'start', 'playing', 'settings'
var startScreen;
var settingsScreen;
var player;
var coins = [];
var trails = [];
var gameSpeed = 8;
var spawnTimer = 0;
var coinCount = 0;
var distanceScore = 0;
var groundY = 2732 - 250;
var playerLives = 3;
var trailTimer = 0;
// UI Elements
var coinText = new Text2('Coins: 0', {
size: 90,
fill: 0xFFFFFF
});
coinText.anchor.set(0, 0);
LK.gui.topLeft.addChild(coinText);
var scoreText = new Text2('Distance: 0', {
size: 90,
fill: 0xFFFFFF
});
scoreText.anchor.set(1, 0);
LK.gui.topRight.addChild(scoreText);
// Create heart UI elements
var hearts = [];
for (var h = 0; h < 3; h++) {
var heart = LK.getAsset('heart', {
anchorX: 0.5,
anchorY: 0.5,
x: 120 + h * 105,
y: 120
});
hearts.push(heart);
LK.gui.topLeft.addChild(heart);
}
// Create ground
var ground = game.addChild(LK.getAsset('ground', {
anchorX: 0,
anchorY: 0,
x: 0,
y: groundY
}));
// Create player (will be added to foreground later)
player = new Player();
player.x = 400;
player.y = groundY;
player.isInvulnerable = false;
// Initialize start screen
startScreen = new StartScreen();
game.addChild(startScreen);
// Touch controls
game.down = function (x, y, obj) {
if (gameState === 'playing') {
player.jump();
}
};
function startGame() {
gameState = 'playing';
if (startScreen && startScreen.parent) {
startScreen.destroy();
}
if (settingsScreen && settingsScreen.parent) {
settingsScreen.destroy();
}
// Reset game variables
coinCount = 0;
distanceScore = 0;
gameSpeed = 8;
playerLives = 3;
coinText.setText('Coins: 0');
scoreText.setText('Distance: 0');
for (var h = 0; h < hearts.length; h++) {
hearts[h].alpha = 1;
}
player.isInvulnerable = false;
}
function showSettings() {
gameState = 'settings';
if (startScreen && startScreen.parent) {
startScreen.destroy();
}
settingsScreen = new SettingsScreen();
game.addChild(settingsScreen);
}
function showStartScreen() {
gameState = 'start';
if (settingsScreen && settingsScreen.parent) {
settingsScreen.destroy();
}
startScreen = new StartScreen();
game.addChild(startScreen);
}
function spawnCoin() {
var coin = new Coin();
coin.x = 2048 + 100;
coin.y = groundY - 100 - Math.random() * 150;
coins.push(coin);
game.addChild(coin);
}
game.update = function () {
if (gameState !== 'playing') {
return;
}
// Increase distance score
distanceScore += 1;
scoreText.setText('Distance: ' + Math.floor(distanceScore / 10));
// Gradually increase speed
gameSpeed = 8 + distanceScore / 2000;
// Move ground with game progression
ground.x -= gameSpeed;
// Reset ground position when it moves too far left
if (ground.x <= -2048) {
ground.x = 0;
}
// Update spawn timer
spawnTimer++;
trailTimer++;
// Create trail when player is jumping
if (player.isJumping && trailTimer % 3 == 0) {
var trail = new Trail();
trail.x = player.x;
trail.y = player.y;
trail.speed = gameSpeed;
trails.push(trail);
game.addChild(trail);
// Fade out trail
tween(trail, {
alpha: 0,
scaleX: 0.3,
scaleY: 0.3
}, {
duration: 500,
onFinish: function onFinish() {
trail.destroy();
}
});
}
// Spawn additional coins
if (spawnTimer % 120 == 0 && Math.random() < 0.4) {
spawnCoin();
}
// Update and check coins
for (var j = coins.length - 1; j >= 0; j--) {
var coin = coins[j];
coin.speed = gameSpeed;
// Check collection
if (!coin.collected && player.intersects(coin)) {
coin.collected = true;
coinCount++;
LK.setScore(coinCount);
coinText.setText('Coins: ' + coinCount);
if (storage.soundEnabled) {
LK.getSound('coin').play();
}
// Visual feedback
LK.effects.flashObject(coin, 0xFFFFFF, 300);
tween(coin, {
alpha: 0,
scaleX: 2,
scaleY: 2
}, {
duration: 300,
onFinish: function onFinish() {
coin.destroy();
}
});
coins.splice(j, 1);
continue;
}
// Remove off-screen coins
if (coin.x < -50) {
coin.destroy();
coins.splice(j, 1);
}
}
// Update and clean up trails
for (var k = trails.length - 1; k >= 0; k--) {
var trail = trails[k];
trail.speed = gameSpeed;
// Remove off-screen or completely faded trails
if (trail.x < -100 || trail.alpha <= 0.1) {
trail.destroy();
trails.splice(k, 1);
}
}
// Ensure player stays in foreground by re-adding it
if (player.parent !== game) {
game.addChild(player);
} else {
// Move player to top of render order
game.removeChild(player);
game.addChild(player);
}
}; ===================================================================
--- original.js
+++ change.js
@@ -98,26 +98,47 @@
titleText.anchor.set(0.5, 0.5);
titleText.x = 2048 / 2;
titleText.y = 800;
self.addChild(titleText);
- // Sound toggle
- var soundText = new Text2('Sound: ' + (storage.soundEnabled ? 'ON' : 'OFF'), {
- size: 80,
- fill: 0xFFFFFF
+ // Sound settings section
+ var soundSectionText = new Text2('SOUND SETTINGS', {
+ size: 90,
+ fill: 0xFFD700
});
- soundText.anchor.set(0.5, 0.5);
- soundText.x = 2048 / 2;
- soundText.y = 1200;
- self.addChild(soundText);
+ soundSectionText.anchor.set(0.5, 0.5);
+ soundSectionText.x = 2048 / 2;
+ soundSectionText.y = 1050;
+ self.addChild(soundSectionText);
+ // Sound toggle button
var soundButton = LK.getAsset('coin', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
- y: 1200,
- scaleX: 4,
- scaleY: 1.5
+ y: 1300,
+ scaleX: 5,
+ scaleY: 2
});
+ // Color the button based on sound state
+ soundButton.tint = storage.soundEnabled ? 0x00FF00 : 0xFF0000;
self.addChild(soundButton);
+ // Sound toggle text
+ var soundText = new Text2(storage.soundEnabled ? 'SOUND: ON' : 'SOUND: OFF', {
+ size: 70,
+ fill: 0x000000
+ });
+ soundText.anchor.set(0.5, 0.5);
+ soundText.x = 2048 / 2;
+ soundText.y = 1300;
+ self.addChild(soundText);
+ // Sound description
+ var soundDescText = new Text2('Toggle game sound effects', {
+ size: 50,
+ fill: 0xCCCCCC
+ });
+ soundDescText.anchor.set(0.5, 0.5);
+ soundDescText.x = 2048 / 2;
+ soundDescText.y = 1450;
+ self.addChild(soundDescText);
// Back button
var backButton = LK.getAsset('coin', {
anchorX: 0.5,
anchorY: 0.5,
@@ -136,12 +157,20 @@
backText.y = 1700;
self.addChild(backText);
self.down = function (x, y, obj) {
var localPos = self.toLocal(obj.parent.toGlobal(obj.position));
- // Check sound button
- if (Math.abs(localPos.x - 2048 / 2) < 200 && Math.abs(localPos.y - 1200) < 60) {
+ // Check sound button - larger hit area for better mobile interaction
+ if (Math.abs(localPos.x - 2048 / 2) < 250 && Math.abs(localPos.y - 1300) < 100) {
storage.soundEnabled = !storage.soundEnabled;
- soundText.setText('Sound: ' + (storage.soundEnabled ? 'ON' : 'OFF'));
+ soundText.setText(storage.soundEnabled ? 'SOUND: ON' : 'SOUND: OFF');
+ // Update button color
+ soundButton.tint = storage.soundEnabled ? 0x00FF00 : 0xFF0000;
+ // Visual feedback
+ LK.effects.flashObject(soundButton, 0xFFFFFF, 200);
+ // Play test sound if enabled
+ if (storage.soundEnabled) {
+ LK.getSound('coin').play();
+ }
}
// Check back button
if (Math.abs(localPos.x - 2048 / 2) < 120 && Math.abs(localPos.y - 1700) < 70) {
showStartScreen();
Just crystal
Just his head
Background, endless, forest, winter, cartoon. In-Game asset. 2d. High contrast. No shadows
Only the line of the ears and the color of the paws should be gray
Only the line of the ears and the color of the paws should be gray
Let C2 have the character's color
Only the line of the ears and the color of the paws should be gray
Delete the character on it
A version without snow
Koyu mavi elips start butonu. In-Game asset. 2d. High contrast. No shadows. In-Game asset. 2d. High contrast. No shadows
UcΜ§an bir dinazor. In-Game asset. 2d. High contrast. No shadows
Alev topu. In-Game asset. 2d. High contrast. No shadows
Mavi top rasengan top. In-Game asset. 2d. High contrast. No shadows
jump
Sound effect
coin
Sound effect
Arkaplanmuzik
Music
gem_collect
Sound effect
happy_giggle
Sound effect
Canazalma
Sound effect
Arkaplanmuzik1
Music
wumpa1
Sound effect
cancan
Sound effect
box_break
Sound effect
tnt_break
Sound effect
enemy_sound
Sound effect
bullet_sound
Sound effect