/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Airplane = Container.expand(function () { var self = Container.call(this); var planeGraphics = self.attachAsset('airplane', { anchorX: 0.5, anchorY: 0.5 }); self.isFlying = false; self.crashed = false; self.startFlight = function () { self.isFlying = true; self.crashed = false; self.x = 200; self.y = 2400; self.rotation = -0.3; // Add rocket animation flying towards top-right corner tween(self, { x: 1800, y: 200, rotation: -0.8 }, { duration: 8000, easing: tween.easeOut }); }; self.crash = function () { self.isFlying = false; self.crashed = true; // Add crash animation tween(self, { rotation: self.rotation + 1.5, scaleX: 0.5, scaleY: 0.5 }, { duration: 500, easing: tween.easeOut }); }; self.update = function () { if (self.isFlying && !self.crashed) { // Keep airplane centered on screen self.x = 1024; // Center horizontally self.y = 1366; // Center vertically // Update background offset to simulate airplane movement var progress = (LK.ticks - gameStartTick) / 300; // seconds (60 * 5 = 300) backgroundOffsetX = -progress * 4; // Move background left (airplane appears to move right) - reduced from 16 to 4 backgroundOffsetY = Math.pow(progress, 1.2) * 150; // Move background down (airplane appears to move up) - reduced from 600 to 150 // Create trail particles if (LK.ticks % 3 === 0) { // Create particle every 3 frames var trail = new TrailParticle(); trail.x = self.x - 30; // Behind the airplane trail.y = self.y + 10; // Slightly offset trail.rotation = self.rotation; trail.tint = 0xff6666; trailParticles.push(trail); game.addChild(trail); } } }; return self; }); var GameButton = Container.expand(function (buttonType) { var self = Container.call(this); var buttonGraphics = self.attachAsset(buttonType === 'bet' ? 'button' : 'cashoutButton', { anchorX: 0.5, anchorY: 0.5 }); self.buttonType = buttonType; self.enabled = true; self.setEnabled = function (enabled) { self.enabled = enabled; self.alpha = enabled ? 1.0 : 0.5; }; self.down = function (x, y, obj) { if (!self.enabled) return; if (self.buttonType === 'bet') { placeBet(); } else if (self.buttonType === 'cashout') { cashOut(); } }; return self; }); var Planet = Container.expand(function (planetType) { var self = Container.call(this); var planetGraphics = self.attachAsset(planetType, { anchorX: 0.5, anchorY: 0.5 }); self.planetType = planetType; self.floatAnimation = function () { var floatDirection = Math.random() > 0.5 ? 1 : -1; var floatDistance = 20 + Math.random() * 30; tween(self, { y: self.y + floatDistance * floatDirection }, { duration: 3000 + Math.random() * 4000, easing: tween.easeInOut, onFinish: function onFinish() { tween(self, { y: self.y - floatDistance * floatDirection }, { duration: 3000 + Math.random() * 4000, easing: tween.easeInOut, onFinish: function onFinish() { self.floatAnimation(); } }); } }); }; return self; }); var Star = Container.expand(function () { var self = Container.call(this); var starGraphics = self.attachAsset('star', { anchorX: 0.5, anchorY: 0.5 }); self.twinkle = function () { tween(self, { alpha: 0.3 }, { duration: 1000 + Math.random() * 2000, easing: tween.easeInOut, onFinish: function onFinish() { tween(self, { alpha: 1 }, { duration: 1000 + Math.random() * 2000, easing: tween.easeInOut, onFinish: function onFinish() { self.twinkle(); } }); } }); }; return self; }); var TrailParticle = Container.expand(function () { var self = Container.call(this); var particleGraphics = LK.getAsset('trail', { width: 20, height: 20, color: 0xff6666, shape: 'ellipse', anchorX: 0.5, anchorY: 0.5 }); self.addChild(particleGraphics); self.lifespan = 60; // 1 second at 60fps self.maxLifespan = 60; self.update = function () { self.lifespan--; self.alpha = self.lifespan / self.maxLifespan; self.scaleX = self.alpha * 0.5; self.scaleY = self.alpha * 0.5; if (self.lifespan <= 0) { self.destroy(); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // Game state variables var gameState = 'waiting'; // 'waiting', 'flying', 'crashed', 'countdown' var currentMultiplier = 1.00; var crashMultiplier = 0; var gameStartTick = 0; var countdownTimer = 0; var playerBet = 0; var playerCashedOut = false; var playerBalance = 1000; var trailParticles = []; var backgroundOffsetX = 0; var backgroundOffsetY = 0; // Create runway var runway = game.addChild(LK.getAsset('runway', { anchorX: 0, anchorY: 1, x: 0, y: 2732 })); // Create stars background var stars = []; for (var i = 0; i < 50; i++) { var star = game.addChild(new Star()); star.x = Math.random() * 2048; star.y = Math.random() * 1500; star.twinkle(); // Add swaying movement towards bottom-left star.velocityX = -0.5 - Math.random() * 1.5; // Move left with random speed star.velocityY = 0.3 + Math.random() * 1.2; // Move down with random speed star.swayAmplitude = 20 + Math.random() * 30; // Random sway amplitude star.swaySpeed = 0.01 + Math.random() * 0.02; // Random sway frequency star.swayOffset = Math.random() * Math.PI * 2; // Random starting sway phase stars.push(star); } // Create planets background (3% of stars = ~2 planets) var planets = []; var planetTypes = ['planet1', 'planet2', 'planet3']; for (var p = 0; p < 2; p++) { var planet = game.addChild(new Planet(planetTypes[p])); planet.x = Math.random() * 1500 + 200; // Keep away from edges planet.y = Math.random() * 1000 + 200; planet.floatAnimation(); // Add swaying movement towards bottom-left (slower than stars) planet.velocityX = -0.2 - Math.random() * 0.8; // Move left slower than stars planet.velocityY = 0.1 + Math.random() * 0.6; // Move down slower than stars planet.swayAmplitude = 15 + Math.random() * 25; // Random sway amplitude planet.swaySpeed = 0.005 + Math.random() * 0.01; // Slower sway frequency planet.swayOffset = Math.random() * Math.PI * 2; // Random starting sway phase planets.push(planet); } // Create airplane var airplane = game.addChild(new Airplane()); // Create UI elements var multiplierText = new Text2('x1.00', { size: 120, fill: 0x00FF00 }); multiplierText.anchor.set(0.5, 0.5); multiplierText.x = 1024; multiplierText.y = 400; game.addChild(multiplierText); var balanceText = new Text2('Balance: $1000', { size: 60, fill: 0xFFFFFF }); balanceText.anchor.set(0, 0); balanceText.x = 50; balanceText.y = 150; game.addChild(balanceText); var betText = new Text2('Bet: $0', { size: 50, fill: 0xFFFF00 }); betText.anchor.set(0, 0); betText.x = 50; betText.y = 220; game.addChild(betText); var statusText = new Text2('Place your bet!', { size: 70, fill: 0xFFFFFF }); statusText.anchor.set(0.5, 0.5); statusText.x = 1024; statusText.y = 600; game.addChild(statusText); var countdownText = new Text2('', { size: 100, fill: 0xFF0000 }); countdownText.anchor.set(0.5, 0.5); countdownText.x = 1024; countdownText.y = 800; game.addChild(countdownText); // Create buttons var betButton = game.addChild(new GameButton('bet')); betButton.x = 300; betButton.y = 2500; var betButtonText = new Text2('BET $100', { size: 40, fill: 0x404040, fontWeight: 'bold' }); betButtonText.anchor.set(0.5, 0.5); betButtonText.x = 300; betButtonText.y = 2500; game.addChild(betButtonText); var cashoutButton = game.addChild(new GameButton('cashout')); cashoutButton.x = 1500; cashoutButton.y = 2500; cashoutButton.setEnabled(false); var cashoutButtonText = new Text2('CASH OUT', { size: 40, fill: 0x404040, fontWeight: 'bold' }); cashoutButtonText.anchor.set(0.5, 0.5); cashoutButtonText.x = 1500; cashoutButtonText.y = 2500; game.addChild(cashoutButtonText); // Add website text to background var websiteText = new Text2('vayabi560.com', { size: 80, fill: 0x333333 }); websiteText.anchor.set(0.5, 0.5); websiteText.x = 424; websiteText.y = 766; websiteText.alpha = 0.3; game.addChild(websiteText); // Add logo to top-right corner var logo = game.addChild(LK.getAsset('logo', { anchorX: 1, anchorY: 0, x: 1928, y: 20 })); // Game functions function generateCrashMultiplier() { // Provably fair random crash point between 1.01 and 50.00 var random = Math.random(); if (random < 0.5) return 1.01 + Math.random() * 1.99; // 1.01-3.00 (50% chance) if (random < 0.8) return 3.00 + Math.random() * 7.00; // 3.00-10.00 (30% chance) return 10.00 + Math.random() * 40.00; // 10.00-50.00 (20% chance) } function placeBet() { if (gameState !== 'waiting' || playerBalance < 100) return; playerBet = 100; playerBalance -= playerBet; playerCashedOut = false; betText.setText('Bet: $' + playerBet); balanceText.setText('Balance: $' + playerBalance); statusText.setText('Good luck!'); betButton.setEnabled(false); // Start game if not already started if (gameState === 'waiting') { startNewRound(); } } function cashOut() { if (gameState !== 'flying' || playerBet === 0 || playerCashedOut) return; var winnings = Math.floor(playerBet * currentMultiplier); playerBalance += winnings; playerCashedOut = true; balanceText.setText('Balance: $' + playerBalance); statusText.setText('Cashed out at x' + currentMultiplier.toFixed(2) + '! Won $' + winnings); cashoutButton.setEnabled(false); LK.getSound('cashout').play(); // Flash green LK.effects.flashObject(multiplierText, 0x00ff00, 500); } function startNewRound() { gameState = 'flying'; gameStartTick = LK.ticks; currentMultiplier = 1.00; crashMultiplier = generateCrashMultiplier(); airplane.startFlight(); if (playerBet > 0 && !playerCashedOut) { cashoutButton.setEnabled(true); } statusText.setText('Flying...'); LK.getSound('takeoff').play(); } function crashPlane() { gameState = 'crashed'; airplane.crash(); if (playerBet > 0 && !playerCashedOut) { statusText.setText('CRASHED! Lost $' + playerBet); // Flash red LK.effects.flashObject(multiplierText, 0xff0000, 1000); } else { statusText.setText('CRASHED at x' + crashMultiplier.toFixed(2)); } multiplierText.tint = 0xff0000; cashoutButton.setEnabled(false); LK.getSound('crash').play(); // Start countdown countdownTimer = 5; LK.setTimeout(function () { startCountdown(); }, 1000); } function startCountdown() { gameState = 'countdown'; var countdownInterval = LK.setInterval(function () { countdownText.setText('Next round in: ' + countdownTimer); countdownTimer--; if (countdownTimer < 0) { LK.clearInterval(countdownInterval); countdownText.setText(''); resetForNextRound(); } }, 1000); } function resetForNextRound() { gameState = 'waiting'; playerBet = 0; playerCashedOut = false; currentMultiplier = 1.00; multiplierText.setText('x1.00'); multiplierText.tint = 0x00ff00; betText.setText('Bet: $0'); statusText.setText('Place your bet!'); betButton.setEnabled(true); cashoutButton.setEnabled(false); airplane.x = 1024; airplane.y = 1366; airplane.rotation = -0.3; airplane.scaleX = 1; airplane.scaleY = 1; // Reset background offsets backgroundOffsetX = 0; backgroundOffsetY = 0; runway.x = 0; runway.y = 2732; // Clear trail particles for (var k = 0; k < trailParticles.length; k++) { trailParticles[k].destroy(); } trailParticles = []; } // Initialize first round resetForNextRound(); game.update = function () { if (gameState === 'flying') { // Calculate current multiplier using exponential growth (25x slower) var secondsFlying = (LK.ticks - gameStartTick) / 1500; // 60 * 25 = 1500 currentMultiplier = Math.pow(1.03, secondsFlying * 60); multiplierText.setText('x' + currentMultiplier.toFixed(2)); // Check if we should crash if (currentMultiplier >= crashMultiplier) { crashPlane(); } // Update cashout button text if (playerBet > 0 && !playerCashedOut) { var potentialWin = Math.floor(playerBet * currentMultiplier); cashoutButtonText.setText('CASH OUT $' + potentialWin); } // Apply background movement to simulate airplane movement runway.x = backgroundOffsetX; runway.y = 2732 + backgroundOffsetY; for (var i = 0; i < stars.length; i++) { var star = stars[i]; // Apply swaying movement var swayX = Math.sin(LK.ticks * star.swaySpeed + star.swayOffset) * star.swayAmplitude * 0.01; star.x += star.velocityX + swayX; star.y += star.velocityY; // Wrap around screen edges if (star.x < -50) star.x = 2098; // Reset to right edge if (star.y > 2782) star.y = -50; // Reset to top edge } // Apply swaying movement to planets for (var p = 0; p < planets.length; p++) { var planet = planets[p]; // Apply swaying movement var swayX = Math.sin(LK.ticks * planet.swaySpeed + planet.swayOffset) * planet.swayAmplitude * 0.01; planet.x += planet.velocityX + swayX; planet.y += planet.velocityY; // Wrap around screen edges (account for planet size) if (planet.x < -250) planet.x = 2298; // Reset to right edge if (planet.y > 2982) planet.y = -250; // Reset to top edge } } // Clean up expired trail particles for (var j = trailParticles.length - 1; j >= 0; j--) { var particle = trailParticles[j]; if (particle.lifespan <= 0) { trailParticles.splice(j, 1); } } };
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Airplane = Container.expand(function () {
var self = Container.call(this);
var planeGraphics = self.attachAsset('airplane', {
anchorX: 0.5,
anchorY: 0.5
});
self.isFlying = false;
self.crashed = false;
self.startFlight = function () {
self.isFlying = true;
self.crashed = false;
self.x = 200;
self.y = 2400;
self.rotation = -0.3;
// Add rocket animation flying towards top-right corner
tween(self, {
x: 1800,
y: 200,
rotation: -0.8
}, {
duration: 8000,
easing: tween.easeOut
});
};
self.crash = function () {
self.isFlying = false;
self.crashed = true;
// Add crash animation
tween(self, {
rotation: self.rotation + 1.5,
scaleX: 0.5,
scaleY: 0.5
}, {
duration: 500,
easing: tween.easeOut
});
};
self.update = function () {
if (self.isFlying && !self.crashed) {
// Keep airplane centered on screen
self.x = 1024; // Center horizontally
self.y = 1366; // Center vertically
// Update background offset to simulate airplane movement
var progress = (LK.ticks - gameStartTick) / 300; // seconds (60 * 5 = 300)
backgroundOffsetX = -progress * 4; // Move background left (airplane appears to move right) - reduced from 16 to 4
backgroundOffsetY = Math.pow(progress, 1.2) * 150; // Move background down (airplane appears to move up) - reduced from 600 to 150
// Create trail particles
if (LK.ticks % 3 === 0) {
// Create particle every 3 frames
var trail = new TrailParticle();
trail.x = self.x - 30; // Behind the airplane
trail.y = self.y + 10; // Slightly offset
trail.rotation = self.rotation;
trail.tint = 0xff6666;
trailParticles.push(trail);
game.addChild(trail);
}
}
};
return self;
});
var GameButton = Container.expand(function (buttonType) {
var self = Container.call(this);
var buttonGraphics = self.attachAsset(buttonType === 'bet' ? 'button' : 'cashoutButton', {
anchorX: 0.5,
anchorY: 0.5
});
self.buttonType = buttonType;
self.enabled = true;
self.setEnabled = function (enabled) {
self.enabled = enabled;
self.alpha = enabled ? 1.0 : 0.5;
};
self.down = function (x, y, obj) {
if (!self.enabled) return;
if (self.buttonType === 'bet') {
placeBet();
} else if (self.buttonType === 'cashout') {
cashOut();
}
};
return self;
});
var Planet = Container.expand(function (planetType) {
var self = Container.call(this);
var planetGraphics = self.attachAsset(planetType, {
anchorX: 0.5,
anchorY: 0.5
});
self.planetType = planetType;
self.floatAnimation = function () {
var floatDirection = Math.random() > 0.5 ? 1 : -1;
var floatDistance = 20 + Math.random() * 30;
tween(self, {
y: self.y + floatDistance * floatDirection
}, {
duration: 3000 + Math.random() * 4000,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(self, {
y: self.y - floatDistance * floatDirection
}, {
duration: 3000 + Math.random() * 4000,
easing: tween.easeInOut,
onFinish: function onFinish() {
self.floatAnimation();
}
});
}
});
};
return self;
});
var Star = Container.expand(function () {
var self = Container.call(this);
var starGraphics = self.attachAsset('star', {
anchorX: 0.5,
anchorY: 0.5
});
self.twinkle = function () {
tween(self, {
alpha: 0.3
}, {
duration: 1000 + Math.random() * 2000,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(self, {
alpha: 1
}, {
duration: 1000 + Math.random() * 2000,
easing: tween.easeInOut,
onFinish: function onFinish() {
self.twinkle();
}
});
}
});
};
return self;
});
var TrailParticle = Container.expand(function () {
var self = Container.call(this);
var particleGraphics = LK.getAsset('trail', {
width: 20,
height: 20,
color: 0xff6666,
shape: 'ellipse',
anchorX: 0.5,
anchorY: 0.5
});
self.addChild(particleGraphics);
self.lifespan = 60; // 1 second at 60fps
self.maxLifespan = 60;
self.update = function () {
self.lifespan--;
self.alpha = self.lifespan / self.maxLifespan;
self.scaleX = self.alpha * 0.5;
self.scaleY = self.alpha * 0.5;
if (self.lifespan <= 0) {
self.destroy();
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
// Game state variables
var gameState = 'waiting'; // 'waiting', 'flying', 'crashed', 'countdown'
var currentMultiplier = 1.00;
var crashMultiplier = 0;
var gameStartTick = 0;
var countdownTimer = 0;
var playerBet = 0;
var playerCashedOut = false;
var playerBalance = 1000;
var trailParticles = [];
var backgroundOffsetX = 0;
var backgroundOffsetY = 0;
// Create runway
var runway = game.addChild(LK.getAsset('runway', {
anchorX: 0,
anchorY: 1,
x: 0,
y: 2732
}));
// Create stars background
var stars = [];
for (var i = 0; i < 50; i++) {
var star = game.addChild(new Star());
star.x = Math.random() * 2048;
star.y = Math.random() * 1500;
star.twinkle();
// Add swaying movement towards bottom-left
star.velocityX = -0.5 - Math.random() * 1.5; // Move left with random speed
star.velocityY = 0.3 + Math.random() * 1.2; // Move down with random speed
star.swayAmplitude = 20 + Math.random() * 30; // Random sway amplitude
star.swaySpeed = 0.01 + Math.random() * 0.02; // Random sway frequency
star.swayOffset = Math.random() * Math.PI * 2; // Random starting sway phase
stars.push(star);
}
// Create planets background (3% of stars = ~2 planets)
var planets = [];
var planetTypes = ['planet1', 'planet2', 'planet3'];
for (var p = 0; p < 2; p++) {
var planet = game.addChild(new Planet(planetTypes[p]));
planet.x = Math.random() * 1500 + 200; // Keep away from edges
planet.y = Math.random() * 1000 + 200;
planet.floatAnimation();
// Add swaying movement towards bottom-left (slower than stars)
planet.velocityX = -0.2 - Math.random() * 0.8; // Move left slower than stars
planet.velocityY = 0.1 + Math.random() * 0.6; // Move down slower than stars
planet.swayAmplitude = 15 + Math.random() * 25; // Random sway amplitude
planet.swaySpeed = 0.005 + Math.random() * 0.01; // Slower sway frequency
planet.swayOffset = Math.random() * Math.PI * 2; // Random starting sway phase
planets.push(planet);
}
// Create airplane
var airplane = game.addChild(new Airplane());
// Create UI elements
var multiplierText = new Text2('x1.00', {
size: 120,
fill: 0x00FF00
});
multiplierText.anchor.set(0.5, 0.5);
multiplierText.x = 1024;
multiplierText.y = 400;
game.addChild(multiplierText);
var balanceText = new Text2('Balance: $1000', {
size: 60,
fill: 0xFFFFFF
});
balanceText.anchor.set(0, 0);
balanceText.x = 50;
balanceText.y = 150;
game.addChild(balanceText);
var betText = new Text2('Bet: $0', {
size: 50,
fill: 0xFFFF00
});
betText.anchor.set(0, 0);
betText.x = 50;
betText.y = 220;
game.addChild(betText);
var statusText = new Text2('Place your bet!', {
size: 70,
fill: 0xFFFFFF
});
statusText.anchor.set(0.5, 0.5);
statusText.x = 1024;
statusText.y = 600;
game.addChild(statusText);
var countdownText = new Text2('', {
size: 100,
fill: 0xFF0000
});
countdownText.anchor.set(0.5, 0.5);
countdownText.x = 1024;
countdownText.y = 800;
game.addChild(countdownText);
// Create buttons
var betButton = game.addChild(new GameButton('bet'));
betButton.x = 300;
betButton.y = 2500;
var betButtonText = new Text2('BET $100', {
size: 40,
fill: 0x404040,
fontWeight: 'bold'
});
betButtonText.anchor.set(0.5, 0.5);
betButtonText.x = 300;
betButtonText.y = 2500;
game.addChild(betButtonText);
var cashoutButton = game.addChild(new GameButton('cashout'));
cashoutButton.x = 1500;
cashoutButton.y = 2500;
cashoutButton.setEnabled(false);
var cashoutButtonText = new Text2('CASH OUT', {
size: 40,
fill: 0x404040,
fontWeight: 'bold'
});
cashoutButtonText.anchor.set(0.5, 0.5);
cashoutButtonText.x = 1500;
cashoutButtonText.y = 2500;
game.addChild(cashoutButtonText);
// Add website text to background
var websiteText = new Text2('vayabi560.com', {
size: 80,
fill: 0x333333
});
websiteText.anchor.set(0.5, 0.5);
websiteText.x = 424;
websiteText.y = 766;
websiteText.alpha = 0.3;
game.addChild(websiteText);
// Add logo to top-right corner
var logo = game.addChild(LK.getAsset('logo', {
anchorX: 1,
anchorY: 0,
x: 1928,
y: 20
}));
// Game functions
function generateCrashMultiplier() {
// Provably fair random crash point between 1.01 and 50.00
var random = Math.random();
if (random < 0.5) return 1.01 + Math.random() * 1.99; // 1.01-3.00 (50% chance)
if (random < 0.8) return 3.00 + Math.random() * 7.00; // 3.00-10.00 (30% chance)
return 10.00 + Math.random() * 40.00; // 10.00-50.00 (20% chance)
}
function placeBet() {
if (gameState !== 'waiting' || playerBalance < 100) return;
playerBet = 100;
playerBalance -= playerBet;
playerCashedOut = false;
betText.setText('Bet: $' + playerBet);
balanceText.setText('Balance: $' + playerBalance);
statusText.setText('Good luck!');
betButton.setEnabled(false);
// Start game if not already started
if (gameState === 'waiting') {
startNewRound();
}
}
function cashOut() {
if (gameState !== 'flying' || playerBet === 0 || playerCashedOut) return;
var winnings = Math.floor(playerBet * currentMultiplier);
playerBalance += winnings;
playerCashedOut = true;
balanceText.setText('Balance: $' + playerBalance);
statusText.setText('Cashed out at x' + currentMultiplier.toFixed(2) + '! Won $' + winnings);
cashoutButton.setEnabled(false);
LK.getSound('cashout').play();
// Flash green
LK.effects.flashObject(multiplierText, 0x00ff00, 500);
}
function startNewRound() {
gameState = 'flying';
gameStartTick = LK.ticks;
currentMultiplier = 1.00;
crashMultiplier = generateCrashMultiplier();
airplane.startFlight();
if (playerBet > 0 && !playerCashedOut) {
cashoutButton.setEnabled(true);
}
statusText.setText('Flying...');
LK.getSound('takeoff').play();
}
function crashPlane() {
gameState = 'crashed';
airplane.crash();
if (playerBet > 0 && !playerCashedOut) {
statusText.setText('CRASHED! Lost $' + playerBet);
// Flash red
LK.effects.flashObject(multiplierText, 0xff0000, 1000);
} else {
statusText.setText('CRASHED at x' + crashMultiplier.toFixed(2));
}
multiplierText.tint = 0xff0000;
cashoutButton.setEnabled(false);
LK.getSound('crash').play();
// Start countdown
countdownTimer = 5;
LK.setTimeout(function () {
startCountdown();
}, 1000);
}
function startCountdown() {
gameState = 'countdown';
var countdownInterval = LK.setInterval(function () {
countdownText.setText('Next round in: ' + countdownTimer);
countdownTimer--;
if (countdownTimer < 0) {
LK.clearInterval(countdownInterval);
countdownText.setText('');
resetForNextRound();
}
}, 1000);
}
function resetForNextRound() {
gameState = 'waiting';
playerBet = 0;
playerCashedOut = false;
currentMultiplier = 1.00;
multiplierText.setText('x1.00');
multiplierText.tint = 0x00ff00;
betText.setText('Bet: $0');
statusText.setText('Place your bet!');
betButton.setEnabled(true);
cashoutButton.setEnabled(false);
airplane.x = 1024;
airplane.y = 1366;
airplane.rotation = -0.3;
airplane.scaleX = 1;
airplane.scaleY = 1;
// Reset background offsets
backgroundOffsetX = 0;
backgroundOffsetY = 0;
runway.x = 0;
runway.y = 2732;
// Clear trail particles
for (var k = 0; k < trailParticles.length; k++) {
trailParticles[k].destroy();
}
trailParticles = [];
}
// Initialize first round
resetForNextRound();
game.update = function () {
if (gameState === 'flying') {
// Calculate current multiplier using exponential growth (25x slower)
var secondsFlying = (LK.ticks - gameStartTick) / 1500; // 60 * 25 = 1500
currentMultiplier = Math.pow(1.03, secondsFlying * 60);
multiplierText.setText('x' + currentMultiplier.toFixed(2));
// Check if we should crash
if (currentMultiplier >= crashMultiplier) {
crashPlane();
}
// Update cashout button text
if (playerBet > 0 && !playerCashedOut) {
var potentialWin = Math.floor(playerBet * currentMultiplier);
cashoutButtonText.setText('CASH OUT $' + potentialWin);
}
// Apply background movement to simulate airplane movement
runway.x = backgroundOffsetX;
runway.y = 2732 + backgroundOffsetY;
for (var i = 0; i < stars.length; i++) {
var star = stars[i];
// Apply swaying movement
var swayX = Math.sin(LK.ticks * star.swaySpeed + star.swayOffset) * star.swayAmplitude * 0.01;
star.x += star.velocityX + swayX;
star.y += star.velocityY;
// Wrap around screen edges
if (star.x < -50) star.x = 2098; // Reset to right edge
if (star.y > 2782) star.y = -50; // Reset to top edge
}
// Apply swaying movement to planets
for (var p = 0; p < planets.length; p++) {
var planet = planets[p];
// Apply swaying movement
var swayX = Math.sin(LK.ticks * planet.swaySpeed + planet.swayOffset) * planet.swayAmplitude * 0.01;
planet.x += planet.velocityX + swayX;
planet.y += planet.velocityY;
// Wrap around screen edges (account for planet size)
if (planet.x < -250) planet.x = 2298; // Reset to right edge
if (planet.y > 2982) planet.y = -250; // Reset to top edge
}
}
// Clean up expired trail particles
for (var j = trailParticles.length - 1; j >= 0; j--) {
var particle = trailParticles[j];
if (particle.lifespan <= 0) {
trailParticles.splice(j, 1);
}
}
};
Create mars 3d views. In-Game asset. 2d. High contrast. No shadows
Create si-fi realistic planet 3D views. In-Game asset. 2d. High contrast. No shadows. In-Game asset. 2d. High contrast. No shadows
Create si-fi realistic starz with lightning 3D views. In-Game asset. 2d. High contrast. No shadows. In-Game asset. 2d. High contrast. No shadows. In-Game asset. 2d. High contrast. No shadows
Create si-fi realistic Green Rectangle BUTTON with 3D views. In-Game asset. 2d. High contrast. With shadows.
Create si-fi realistic Orange Rectangle BUTTON with 3D views. In-Game asset. 2d. High contrast. With shadows.. In-Game asset. 2d. High contrast. No shadows