User prompt
3.sayfanın sağ alt köşesine 4.ekranı açan buton ekle
User prompt
yıldız butonu ücreti 2000 dolar . Yıldız butonuna tıkladığımız zaman 30 hisseden rastgele bir tanesi hakkında tahmin yap . Tahmin 'AL' veya 'SAT' ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
yıldız butonunun sol tarafına borsayı durdurma başlatma butonu ekle
User prompt
yıldız butonunu biraz daha sola taşı
User prompt
3.sayfadaki 'BORSA' yazısının sol tarafına yıldız butonu ekle
User prompt
3.sayfanın sağ üst köşesine soru işareti butonu ekle
User prompt
borsa ekranında sahip olduğumuz hisselerde ne kadar kar zarar ettiğimiz yazsın ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
borsa hisselerine taban ve tavan fiyatı ekle . hisselerin taban ve tavan fiyatları sırasıyla ; Turk AİR 200 dolar ile 1000 dolar , Wings AİR 90 dolar ile 300 dolar , KO Cola 124 dolar ile 1200 dolar , BAM Burger 1132 dolar ile 1400 dolar , Starfack 268 dolar ile 700 dolar arası , Zamsung 168 dolar ile 450 dolar arası , Aaple 220 dolar ile 280 dolar arası , Amazong 640 dolar ile 1020 dolar arası ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
borsa hisselerinin son 5 dakikada ne kadar artıp azaldığını yüzdelik veri olarak göster ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
borsa ekranındaki sahip olunan hisse sayısını biraz daha sağa taşıyın
User prompt
borsa hisselerindeki al sat butonunu ekranın sağ tarafına taşı
User prompt
borsa hisselerinin isimlerini değiştir. İsimler sırasıyla ; Turk AİR , Wings AİR , KO Cola , BAM Burger , Starfack , Zamsung , Aaple , Amazong , Alipapa , Nexflix , Ndvideo , Macnasoft , Geogle , Inzell , BİG Bank , AA Finance , AUTI , BMV , Mernedes , META , Gassfrom , Sun Energy , Redbool , Telsa , Nİxe , Abidas , MAG GAME , Bitcoin , Etherium , MAG COİN
User prompt
3.sayfadaki para miktarı yazısını koyu yeşil renk yap
User prompt
'BORSA' yazısının altına 30 tane borsa hissesi ekle. Borsa hisseleri satın alınıp satılabilir. Borsa hisselerinin fiyatı sürekli değişmektedir. Borsa hisseleri fiyatı artıp azalabilir. Alınan hisse adetini göster. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
3.sayfada yer alan 'BORSA' yazısını en üstü taşı
User prompt
3.sayfada yer alan 'GERİ' yazısını değiştir . Yeni yazı 'PARA'
User prompt
2.sayfada yer alan 'BACK' yazısını değiştir. Yeni yazı 'MENÜ'
User prompt
3.sayfada yer alan 'İLERİ' yazısını değiştir yeni yazı 'BORSA'
User prompt
oyun sıfırlandığında , balon butonu , uçak butonu , jet butonu ve hediye kutusu butonu aktifliği kapatılsın
User prompt
oyun sıfırlandığı zaman balon butonu , uçak butonu , jet butonu ve hediye kutusu butonuda sıfırlansın . Tekrar satın alınabilsin
User prompt
unvan yazınsını biraz daha aşağıya taşı
User prompt
unvan yazısını biraz daha aşağı taşı ve kalınlaştır
User prompt
unvan yazısını biraz daha aşağıya taşı
User prompt
para kazanma butonunun altında unvan yazsın. Unvanımız para miktarına göre değişsin. 0-50000 dolar arası 'FASFAKİR' , 50001-100000 dola arası 'FAKİR' , 100001-500000 dolar arasın 'ORTADİREK' , 500001-2000000 dolar arası 'MİLYONER' , 2000001 ve daha fazlası 'MİLYADER' yazsın. Yazı siyah renk olsun
User prompt
soru işareti düğmesine tıkladığımızda karşımıza bir mesaj kutusu çıksın. Mesajda yazacak metin : HAYDİ oyunun temel mantığını öğrenelim. Burası para kazanma ekranı . Her tıkladığınızda para kazanın . Balon , uçak , jet ve hediye kutusu düğmelerine tıklayarak daha çok para kazan. Unvan para miktarına göre değişmektedir.
/****
* Plugins
****/
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var GameScreen = Container.expand(function () {
var self = Container.call(this);
// Initialize balloon purchase status
self.balloonPurchased = storage.balloonPurchased || false;
// Initialize airplane purchase status
self.airplanePurchased = storage.airplanePurchased || false;
// Initialize jet purchase status
self.jetPurchased = storage.jetPurchased || false;
// Initialize gift box purchase status
self.giftBoxPurchased = storage.giftBoxPurchased || false;
// Header text
var headerText = new Text2('TIKLA KAZAN', {
size: 150,
fill: 0x006400
});
headerText.anchor.set(0.5, 0);
headerText.x = 2048 / 2;
headerText.y = 100;
self.addChild(headerText);
// Gift box button to the left of header text
var giftBoxButtonText = self.giftBoxPurchased ? '🎁' : '🎁 : $10000';
var giftBoxButton = new MenuButton(giftBoxButtonText, 250, 120);
giftBoxButton.x = headerText.x - 600; // Move even further to the left of header text
giftBoxButton.y = headerText.y + 75; // Align vertically with header
giftBoxButton.onPress = function () {
if (!self.giftBoxPurchased) {
// Check if player has enough money to buy gift box
if (self.currentMoney >= 10000) {
self.currentMoney -= 10000;
self.giftBoxPurchased = true;
storage.giftBoxPurchased = true;
self.updateMoney();
// Update button text to remove price
giftBoxButton.removeChild(giftBoxButton.children[1]); // Remove old text
var newButtonText = new Text2('🎁', {
size: 60,
fill: 0x000000
});
newButtonText.anchor.set(0.5, 0.5);
giftBoxButton.addChild(newButtonText);
LK.effects.flashObject(giftBoxButton, 0x00FF00, 300);
// Start gift box passive income timer
self.startGiftBoxIncome();
} else {
// Not enough money - flash red
LK.effects.flashObject(giftBoxButton, 0xFF0000, 300);
}
} else {
// Gift box already purchased - flash gold
LK.effects.flashObject(giftBoxButton, 0xFFD700, 300);
}
};
self.addChild(giftBoxButton);
// Money display with green border
var moneyBorder = self.attachAsset('buttonBg', {
anchorX: 0.5,
anchorY: 0.5,
width: 300,
height: 120,
x: 2048 / 2,
y: 350
});
// Change border color to green
moneyBorder.tint = 0x00FF00;
var moneyText = new Text2('$0', {
size: 100,
fill: 0xFFFFFF
});
moneyText.anchor.set(0.5, 0.5);
moneyText.x = 2048 / 2;
moneyText.y = 350;
self.addChild(moneyText);
// Center earn button
var earnButton = new MenuButton('KAZANMAK İÇİN TIKLA', 400, 100);
earnButton.x = 2048 / 2 + 100; // Move to the right
earnButton.y = 1200; // Move higher up on screen
// Add dollar sign to earn button
var dollarIcon = earnButton.attachAsset('dollarSign', {
anchorX: 0.5,
anchorY: 0.5,
x: -50,
y: 0
});
// Add dollar sign text
var dollarText = new Text2('$', {
size: 50,
fill: 0x000000
});
dollarText.anchor.set(0.5, 0.5);
dollarText.x = -50;
dollarText.y = 0;
earnButton.addChild(dollarText);
earnButton.onPress = function () {
var earnAmount = 25;
if (self.balloonPurchased) earnAmount = 35;
if (self.airplanePurchased) earnAmount = 50;
self.currentMoney += earnAmount;
self.updateMoney();
LK.effects.flashObject(moneyText, 0x00FF00, 300);
};
self.addChild(earnButton);
// Question mark button in top right corner
// Title display below earn button
var titleText = new Text2('FASFAKİR', {
size: 80,
fill: 0x000000,
fontWeight: 'bold'
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 2048 / 2;
titleText.y = 1650; // Position even further down below earn button
self.addChild(titleText);
var questionButton = new MenuButton('?', 80, 80);
questionButton.x = 1900; // Top right corner with margin for border
questionButton.y = 120; // Top with margin for border
questionButton.onPress = function () {
// Flash the button when pressed
LK.effects.flashObject(questionButton, 0x00FF00, 300);
// Show help message box
self.showHelpMessage();
};
self.addChild(questionButton);
// Back button
var backButton = new MenuButton('MENÜ', 200, 80);
backButton.x = 150;
backButton.y = 2632;
backButton.onPress = function () {
showMainMenu();
};
self.addChild(backButton);
// Third page button in bottom right
var thirdPageButton = new MenuButton('BORSA', 200, 80);
thirdPageButton.x = 1898; // Right side with margin for border
thirdPageButton.y = 2632; // Bottom with margin for border
thirdPageButton.onPress = function () {
showThirdPage();
};
self.addChild(thirdPageButton);
// Jet button above airplane
var jetButtonText = self.jetPurchased ? '🚀' : '🚀 : $10000';
var jetButton = new MenuButton(jetButtonText, 250, 150);
jetButton.x = 2048 / 2;
jetButton.y = 2100; // Position above airplane button
jetButton.onPress = function () {
if (!self.jetPurchased) {
// Check if player has enough money to buy jet
if (self.currentMoney >= 10000) {
self.currentMoney -= 10000;
self.jetPurchased = true;
storage.jetPurchased = true;
self.updateMoney();
// Update button text to remove price
jetButton.removeChild(jetButton.children[1]); // Remove old text
var newButtonText = new Text2('🚀', {
size: 60,
fill: 0x000000
});
newButtonText.anchor.set(0.5, 0.5);
jetButton.addChild(newButtonText);
LK.effects.flashObject(jetButton, 0x00FF00, 300);
// Start jet passive income timer
self.startJetIncome();
} else {
// Not enough money - flash red
LK.effects.flashObject(jetButton, 0xFF0000, 300);
}
} else {
// Jet already purchased - flash purple
LK.effects.flashObject(jetButton, 0x8A2BE2, 300);
}
};
self.addChild(jetButton);
// Airplane button above balloon
var airplaneButtonText = self.airplanePurchased ? '✈️' : '✈️ : $5000';
var airplaneButton = new MenuButton(airplaneButtonText, 200, 150);
airplaneButton.x = 2048 / 2;
airplaneButton.y = 2300; // Position above balloon button
airplaneButton.onPress = function () {
if (!self.airplanePurchased) {
// Check if player has enough money to buy airplane
if (self.currentMoney >= 5000) {
self.currentMoney -= 5000;
self.airplanePurchased = true;
storage.airplanePurchased = true;
self.updateMoney();
// Update button text to remove price
airplaneButton.removeChild(airplaneButton.children[1]); // Remove old text
var newButtonText = new Text2('✈️', {
size: 60,
fill: 0x000000
});
newButtonText.anchor.set(0.5, 0.5);
airplaneButton.addChild(newButtonText);
LK.effects.flashObject(airplaneButton, 0x00FF00, 300);
} else {
// Not enough money - flash red
LK.effects.flashObject(airplaneButton, 0xFF0000, 300);
}
} else {
// Airplane already purchased - flash blue
LK.effects.flashObject(airplaneButton, 0x87CEEB, 300);
}
};
self.addChild(airplaneButton);
// Golden balloon button
var balloonButtonText = self.balloonPurchased ? '🎈' : '🎈 $1000';
var balloonButton = new MenuButton(balloonButtonText, 200, 150);
balloonButton.x = 2048 / 2;
balloonButton.y = 2500; // Move to bottom of screen
balloonButton.onPress = function () {
if (!self.balloonPurchased) {
// Check if player has enough money to buy balloon
if (self.currentMoney >= 1000) {
self.currentMoney -= 1000;
self.balloonPurchased = true;
storage.balloonPurchased = true;
self.updateMoney();
// Update button text to remove price
balloonButton.removeChild(balloonButton.children[1]); // Remove old text
var newButtonText = new Text2('🎈', {
size: 60,
fill: 0x000000
});
newButtonText.anchor.set(0.5, 0.5);
balloonButton.addChild(newButtonText);
LK.effects.flashObject(balloonButton, 0x00FF00, 300);
} else {
// Not enough money - flash red
LK.effects.flashObject(balloonButton, 0xFF0000, 300);
}
} else {
// Balloon already purchased - flash gold
LK.effects.flashObject(balloonButton, 0xFFD700, 300);
}
};
self.addChild(balloonButton);
self.currentMoney = storage.money || 0;
self.updateMoney = function () {
moneyText.setText('$' + self.currentMoney);
storage.money = self.currentMoney;
// Update title based on money amount
var newTitle = '';
if (self.currentMoney <= 50000) {
newTitle = 'FASFAKİR';
} else if (self.currentMoney <= 100000) {
newTitle = 'FAKİR';
} else if (self.currentMoney <= 500000) {
newTitle = 'ORTADİREK';
} else if (self.currentMoney <= 2000000) {
newTitle = 'MİLYONER';
} else {
newTitle = 'MİLYARDER';
}
titleText.setText(newTitle);
};
// Jet passive income functionality
self.startJetIncome = function () {
// Give 200 dollars every 5 minutes (300000 ms)
self.jetTimer = LK.setInterval(function () {
if (self.jetPurchased) {
self.currentMoney += 200;
self.updateMoney();
LK.effects.flashObject(moneyText, 0x8A2BE2, 500);
}
}, 300000); // 5 minutes = 300000 milliseconds
};
// Gift box passive income functionality
self.startGiftBoxIncome = function () {
// Give 1000 dollars every 10 minutes (600000 ms)
self.giftBoxTimer = LK.setInterval(function () {
if (self.giftBoxPurchased) {
self.currentMoney += 1000;
self.updateMoney();
LK.effects.flashObject(moneyText, 0xFFD700, 500);
}
}, 600000); // 10 minutes = 600000 milliseconds
};
// Start jet income if already purchased
if (self.jetPurchased) {
self.startJetIncome();
}
// Start gift box income if already purchased
if (self.giftBoxPurchased) {
self.startGiftBoxIncome();
}
// Help message functionality
self.showHelpMessage = function () {
// Create semi-transparent overlay
var overlay = self.attachAsset('background', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0
});
overlay.tint = 0x000000;
overlay.alpha = 0.7;
// Create message box background
var messageBox = self.attachAsset('buttonBg', {
anchorX: 0.5,
anchorY: 0.5,
width: 1600,
height: 1200,
x: 2048 / 2,
y: 2732 / 2
});
messageBox.tint = 0xFFFFFF;
// Create message text
var messageText = new Text2('HAYDİ oyunun temel mantığını öğrenelim.\n\nBurası para kazanma ekranı.\n\nHer tıkladığınızda para kazanın.\n\nBalon, uçak, jet ve hediye kutusu\ndüğmelerine tıklayarak daha çok para kazan.\n\nUnvan para miktarına göre değişmektedir.', {
size: 80,
fill: 0x000000,
wordWrap: true,
wordWrapWidth: 1400
});
messageText.anchor.set(0.5, 0.5);
messageText.x = 2048 / 2;
messageText.y = 2732 / 2 - 100;
self.addChild(messageText);
// Create close button
var closeButton = new MenuButton('KAPAT', 300, 100);
closeButton.x = 2048 / 2;
closeButton.y = 2732 / 2 + 400;
closeButton.onPress = function () {
// Remove all message box elements
self.removeChild(overlay);
self.removeChild(messageBox);
self.removeChild(messageText);
self.removeChild(closeButton);
overlay.destroy();
messageBox.destroy();
messageText.destroy();
closeButton.destroy();
};
self.addChild(closeButton);
};
self.updateMoney();
return self;
});
var MainMenu = Container.expand(function () {
var self = Container.call(this);
// Game title
var titleText = new Text2('MONEY MAN', {
size: 200,
fill: 0x006400
});
titleText.anchor.set(0.5, 0);
titleText.x = 2048 / 2;
titleText.y = 300;
self.addChild(titleText);
// Start button
var startButton = new MenuButton('BAŞLA');
startButton.x = 2048 / 2;
startButton.y = 1000;
startButton.onPress = function () {
showGameScreen();
};
self.addChild(startButton);
// Continue button
var continueButton = new MenuButton('KAYITLI OYUNA DEVAM ET');
continueButton.x = 2048 / 2;
continueButton.y = 1200;
continueButton.onPress = function () {
showGameScreen();
};
self.addChild(continueButton);
// Delete button
var deleteButton = new MenuButton('Oyunu Sıfırla');
deleteButton.x = 2048 / 2;
deleteButton.y = 1400;
deleteButton.onPress = function () {
storage.money = 0;
storage.balloonPurchased = false;
storage.airplanePurchased = false;
storage.jetPurchased = false;
storage.giftBoxPurchased = false;
// Clear any active timers in current game screen
if (gameScreen && gameScreen.jetTimer) {
LK.clearInterval(gameScreen.jetTimer);
gameScreen.jetTimer = null;
}
if (gameScreen && gameScreen.giftBoxTimer) {
LK.clearInterval(gameScreen.giftBoxTimer);
gameScreen.giftBoxTimer = null;
}
// Reset purchase statuses in current game screen instance
if (gameScreen) {
gameScreen.balloonPurchased = false;
gameScreen.airplanePurchased = false;
gameScreen.jetPurchased = false;
gameScreen.giftBoxPurchased = false;
}
LK.effects.flashScreen(0xFF0000, 500);
};
self.addChild(deleteButton);
return self;
});
var MenuButton = Container.expand(function (text, width, height) {
var self = Container.call(this);
width = width || 600;
height = height || 120;
var buttonBackground = self.attachAsset('buttonBg', {
anchorX: 0.5,
anchorY: 0.5,
width: width,
height: height
});
var buttonText = new Text2(text, {
size: 60,
fill: 0x000000
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.down = function (x, y, obj) {
LK.getSound('click').play();
buttonBackground.alpha = 0.8;
};
self.up = function (x, y, obj) {
buttonBackground.alpha = 1.0;
if (self.onPress) {
self.onPress();
}
};
return self;
});
var ThirdPage = Container.expand(function () {
var self = Container.call(this);
// Initialize stock data
self.stocks = [];
var stockNames = ['Turk AİR', 'Wings AİR', 'KO Cola', 'BAM Burger', 'Starfack', 'Zamsung', 'Aaple', 'Amazong', 'Alipapa', 'Nexflix', 'Ndvideo', 'Macnasoft', 'Geogle', 'Inzell', 'BİG Bank', 'AA Finance', 'AUTI', 'BMV', 'Mernedes', 'META', 'Gassfrom', 'Sun Energy', 'Redbool', 'Telsa', 'Nİxe', 'Abidas', 'MAG GAME', 'Bitcoin', 'Etherium', 'MAG COİN'];
// Define floor and ceiling prices for each stock
var stockLimits = [{
floor: 200,
ceiling: 1000
},
// Turk AİR
{
floor: 90,
ceiling: 300
},
// Wings AİR
{
floor: 124,
ceiling: 1200
},
// KO Cola
{
floor: 1132,
ceiling: 1400
},
// BAM Burger
{
floor: 268,
ceiling: 700
},
// Starfack
{
floor: 168,
ceiling: 450
},
// Zamsung
{
floor: 220,
ceiling: 280
},
// Aaple
{
floor: 640,
ceiling: 1020
},
// Amazong
{
floor: 100,
ceiling: 1000
},
// Alipapa (default)
{
floor: 100,
ceiling: 1000
},
// Nexflix (default)
{
floor: 100,
ceiling: 1000
},
// Ndvideo (default)
{
floor: 100,
ceiling: 1000
},
// Macnasoft (default)
{
floor: 100,
ceiling: 1000
},
// Geogle (default)
{
floor: 100,
ceiling: 1000
},
// Inzell (default)
{
floor: 100,
ceiling: 1000
},
// BİG Bank (default)
{
floor: 100,
ceiling: 1000
},
// AA Finance (default)
{
floor: 100,
ceiling: 1000
},
// AUTI (default)
{
floor: 100,
ceiling: 1000
},
// BMV (default)
{
floor: 100,
ceiling: 1000
},
// Mernedes (default)
{
floor: 100,
ceiling: 1000
},
// META (default)
{
floor: 100,
ceiling: 1000
},
// Gassfrom (default)
{
floor: 100,
ceiling: 1000
},
// Sun Energy (default)
{
floor: 100,
ceiling: 1000
},
// Redbool (default)
{
floor: 100,
ceiling: 1000
},
// Telsa (default)
{
floor: 100,
ceiling: 1000
},
// Nİxe (default)
{
floor: 100,
ceiling: 1000
},
// Abidas (default)
{
floor: 100,
ceiling: 1000
},
// MAG GAME (default)
{
floor: 100,
ceiling: 1000
},
// Bitcoin (default)
{
floor: 100,
ceiling: 1000
},
// Etherium (default)
{
floor: 100,
ceiling: 1000
} // MAG COİN (default)
];
// Initialize stock prices and owned amounts from storage
for (var i = 0; i < stockNames.length; i++) {
var stockKey = 'stock_' + stockNames[i];
var priceKey = 'price_' + stockNames[i];
var ownedKey = 'owned_' + stockNames[i];
var fiveMinPriceKey = 'fiveMinPrice_' + stockNames[i];
var purchasePriceKey = 'purchasePrice_' + stockNames[i];
var limits = stockLimits[i];
var currentPrice = storage[priceKey] || Math.random() * (limits.ceiling - limits.floor) + limits.floor;
// Ensure price stays within limits
currentPrice = Math.max(limits.floor, Math.min(limits.ceiling, currentPrice));
self.stocks.push({
name: stockNames[i],
price: currentPrice,
owned: storage[ownedKey] || 0,
lastPrice: currentPrice,
fiveMinutePrice: storage[fiveMinPriceKey] || currentPrice,
purchasePrice: storage[purchasePriceKey] || currentPrice,
percentChange: 0,
floorPrice: limits.floor,
ceilingPrice: limits.ceiling
});
}
// Header text
var headerText = new Text2('BORSA', {
size: 150,
fill: 0x006400
});
headerText.anchor.set(0.5, 0);
headerText.x = 2048 / 2;
headerText.y = 100;
self.addChild(headerText);
// Market pause/start button to the left of star button
self.marketPaused = false;
var marketButton = new MenuButton('⏸️', 80, 80);
marketButton.x = headerText.x - 400; // Position to the left of star button
marketButton.y = headerText.y + 75; // Align vertically with header
marketButton.onPress = function () {
self.marketPaused = !self.marketPaused;
if (self.marketPaused) {
// Change button to play symbol
marketButton.removeChild(marketButton.children[1]); // Remove old text
var playButtonText = new Text2('▶️', {
size: 60,
fill: 0x000000
});
playButtonText.anchor.set(0.5, 0.5);
marketButton.addChild(playButtonText);
LK.effects.flashObject(marketButton, 0xFF0000, 300);
} else {
// Change button to pause symbol
marketButton.removeChild(marketButton.children[1]); // Remove old text
var pauseButtonText = new Text2('⏸️', {
size: 60,
fill: 0x000000
});
pauseButtonText.anchor.set(0.5, 0.5);
marketButton.addChild(pauseButtonText);
LK.effects.flashObject(marketButton, 0x00FF00, 300);
}
};
self.addChild(marketButton);
// Star button to the left of BORSA text
var starButton = new MenuButton('★', 80, 80);
starButton.x = headerText.x - 300; // Position further to the left of BORSA text
starButton.y = headerText.y + 75; // Align vertically with header
starButton.onPress = function () {
// Flash the button when pressed
LK.effects.flashObject(starButton, 0xFFD700, 300);
};
self.addChild(starButton);
// Money display
var moneyDisplay = new Text2('Para: $0', {
size: 80,
fill: 0x006400
});
moneyDisplay.anchor.set(0.5, 0);
moneyDisplay.x = 2048 / 2;
moneyDisplay.y = 250;
self.addChild(moneyDisplay);
// Update money display
self.updateMoneyDisplay = function () {
var currentMoney = storage.money || 0;
moneyDisplay.setText('Para: $' + currentMoney);
};
self.updateMoneyDisplay();
// Stock list container
var stockContainer = new Container();
stockContainer.x = 100;
stockContainer.y = 400;
self.addChild(stockContainer);
// Create stock entries
self.stockEntries = [];
for (var i = 0; i < self.stocks.length; i++) {
var stock = self.stocks[i];
var yPos = i * 70;
// Stock background
var stockBg = stockContainer.attachAsset('smallButtonBg', {
anchorX: 0,
anchorY: 0,
width: 1800,
height: 60,
x: 0,
y: yPos
});
stockBg.tint = 0xF0F0F0;
// Stock name text
var nameText = new Text2(stock.name, {
size: 40,
fill: 0x000000
});
nameText.anchor.set(0, 0.5);
nameText.x = 20;
nameText.y = yPos + 30;
stockContainer.addChild(nameText);
// Stock price text
var priceText = new Text2('$' + Math.floor(stock.price), {
size: 40,
fill: 0x000000
});
priceText.anchor.set(0, 0.5);
priceText.x = 250;
priceText.y = yPos + 30;
stockContainer.addChild(priceText);
// Owned amount text
var ownedText = new Text2('Sahip: ' + stock.owned, {
size: 40,
fill: 0x000000
});
ownedText.anchor.set(0, 0.5);
ownedText.x = 750;
ownedText.y = yPos + 30;
stockContainer.addChild(ownedText);
// Percentage change text
var percentText = new Text2('0.00%', {
size: 35,
fill: 0x000000
});
percentText.anchor.set(0, 0.5);
percentText.x = 950;
percentText.y = yPos + 30;
stockContainer.addChild(percentText);
// Profit/Loss text
var profitLossText = new Text2('K/Z: $0', {
size: 35,
fill: 0x000000
});
profitLossText.anchor.set(0, 0.5);
profitLossText.x = 1150;
profitLossText.y = yPos + 30;
stockContainer.addChild(profitLossText);
// Buy button
var buyButton = new MenuButton('AL', 120, 50);
buyButton.x = 1550;
buyButton.y = yPos + 30;
buyButton.stockIndex = i;
buyButton.onPress = function () {
var stockIndex = this.stockIndex;
var stock = self.stocks[stockIndex];
var currentMoney = storage.money || 0;
var stockPrice = Math.floor(stock.price);
if (currentMoney >= stockPrice) {
storage.money = currentMoney - stockPrice;
// Calculate new average purchase price
var totalValue = stock.purchasePrice * stock.owned + stockPrice;
stock.owned += 1;
stock.purchasePrice = totalValue / stock.owned;
storage['owned_' + stock.name] = stock.owned;
storage['purchasePrice_' + stock.name] = stock.purchasePrice;
self.updateStockDisplay();
self.updateMoneyDisplay();
LK.effects.flashObject(this, 0x00FF00, 300);
} else {
LK.effects.flashObject(this, 0xFF0000, 300);
}
};
stockContainer.addChild(buyButton);
// Sell button
var sellButton = new MenuButton('SAT', 120, 50);
sellButton.x = 1700;
sellButton.y = yPos + 30;
sellButton.stockIndex = i;
sellButton.onPress = function () {
var stockIndex = this.stockIndex;
var stock = self.stocks[stockIndex];
if (stock.owned > 0) {
var currentMoney = storage.money || 0;
var stockPrice = Math.floor(stock.price);
storage.money = currentMoney + stockPrice;
stock.owned -= 1;
storage['owned_' + stock.name] = stock.owned;
self.updateStockDisplay();
self.updateMoneyDisplay();
LK.effects.flashObject(this, 0x00FF00, 300);
} else {
LK.effects.flashObject(this, 0xFF0000, 300);
}
};
stockContainer.addChild(sellButton);
self.stockEntries.push({
stock: stock,
priceText: priceText,
ownedText: ownedText,
stockBg: stockBg,
percentText: percentText,
profitLossText: profitLossText
});
}
// Update stock display function
self.updateStockDisplay = function () {
for (var i = 0; i < self.stockEntries.length; i++) {
var entry = self.stockEntries[i];
var stock = entry.stock;
entry.priceText.setText('$' + Math.floor(stock.price));
entry.ownedText.setText('Sahip: ' + stock.owned);
// Calculate percentage change from 5 minutes ago
stock.percentChange = (stock.price - stock.fiveMinutePrice) / stock.fiveMinutePrice * 100;
var percentText = (stock.percentChange >= 0 ? '+' : '') + stock.percentChange.toFixed(2) + '%';
entry.percentText.setText(percentText);
// Calculate profit/loss for owned stocks
var profitLoss = 0;
if (stock.owned > 0) {
profitLoss = (stock.price - stock.purchasePrice) * stock.owned;
}
var profitLossText = 'K/Z: $' + Math.floor(profitLoss);
entry.profitLossText.setText(profitLossText);
// Color code based on percentage change
if (stock.percentChange > 0) {
entry.percentText.fill = 0x00AA00; // Green for positive change
entry.stockBg.tint = 0x90EE90; // Light green background
} else if (stock.percentChange < 0) {
entry.percentText.fill = 0xAA0000; // Red for negative change
entry.stockBg.tint = 0xFFB6C1; // Light red background
} else {
entry.percentText.fill = 0x000000; // Black for no change
entry.stockBg.tint = 0xF0F0F0; // Default gray background
}
// Color code profit/loss text
if (profitLoss > 0) {
entry.profitLossText.fill = 0x00AA00; // Green for profit
} else if (profitLoss < 0) {
entry.profitLossText.fill = 0xAA0000; // Red for loss
} else {
entry.profitLossText.fill = 0x000000; // Black for no profit/loss
}
stock.lastPrice = stock.price;
}
};
// Price fluctuation timer
self.priceTimer = LK.setInterval(function () {
if (!self.marketPaused) {
for (var i = 0; i < self.stocks.length; i++) {
var stock = self.stocks[i];
// Random price change between -10% to +10%
var changePercent = (Math.random() - 0.5) * 0.2;
var newPrice = stock.price * (1 + changePercent);
// Enforce floor and ceiling limits
stock.price = Math.max(stock.floorPrice, Math.min(stock.ceilingPrice, newPrice));
storage['price_' + stock.name] = stock.price;
}
self.updateStockDisplay();
}
}, 3000); // Update every 3 seconds
// 5-minute timer to update baseline prices for percentage calculation
self.fiveMinuteTimer = LK.setInterval(function () {
if (!self.marketPaused) {
for (var i = 0; i < self.stocks.length; i++) {
var stock = self.stocks[i];
stock.fiveMinutePrice = stock.price;
storage['fiveMinPrice_' + stock.name] = stock.fiveMinutePrice;
}
}
}, 300000); // Update every 5 minutes (300000 ms)
// Question mark button in top right corner
var questionButton = new MenuButton('?', 80, 80);
questionButton.x = 1900; // Top right corner with margin for border
questionButton.y = 120; // Top with margin for border
questionButton.onPress = function () {
// Flash the button when pressed
LK.effects.flashObject(questionButton, 0x00FF00, 300);
// Show help message for stock market
self.showStockHelpMessage();
};
self.addChild(questionButton);
// Back button to game screen
var backButton = new MenuButton('PARA', 200, 80);
backButton.x = 150;
backButton.y = 2632;
backButton.onPress = function () {
showGameScreen();
};
self.addChild(backButton);
// Stock market help message functionality
self.showStockHelpMessage = function () {
// Create semi-transparent overlay
var overlay = self.attachAsset('background', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0
});
overlay.tint = 0x000000;
overlay.alpha = 0.7;
// Create message box background
var messageBox = self.attachAsset('buttonBg', {
anchorX: 0.5,
anchorY: 0.5,
width: 1600,
height: 1200,
x: 2048 / 2,
y: 2732 / 2
});
messageBox.tint = 0xFFFFFF;
// Create message text
var messageText = new Text2('BORSA EKRANI YARDIM\n\nBu ekranda hisse senetleri alıp satabilirsiniz.\n\nHer hissenin fiyatı sürekli değişir.\n\nYeşil renk: Fiyat artışı\nKırmızı renk: Fiyat düşüşü\n\n% değişim son 5 dakikaya göredir.\n\nK/Z: Kar/Zarar durumunuzu gösterir.\n\nAL butonu ile hisse alın.\nSAT butonu ile hisse satın.', {
size: 70,
fill: 0x000000,
wordWrap: true,
wordWrapWidth: 1400
});
messageText.anchor.set(0.5, 0.5);
messageText.x = 2048 / 2;
messageText.y = 2732 / 2 - 100;
self.addChild(messageText);
// Create close button
var closeButton = new MenuButton('KAPAT', 300, 100);
closeButton.x = 2048 / 2;
closeButton.y = 2732 / 2 + 400;
closeButton.onPress = function () {
// Remove all message box elements
self.removeChild(overlay);
self.removeChild(messageBox);
self.removeChild(messageText);
self.removeChild(closeButton);
overlay.destroy();
messageBox.destroy();
messageText.destroy();
closeButton.destroy();
};
self.addChild(closeButton);
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0xD3D3D3
});
/****
* Game Code
****/
// Background
var background = game.attachAsset('background', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0
});
// Border elements
var topBorder = game.attachAsset('border', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0
});
var bottomBorder = game.attachAsset('border', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 2682
});
var leftBorder = game.attachAsset('border', {
anchorX: 0,
anchorY: 0,
width: 50,
height: 2732,
x: 0,
y: 0
});
var rightBorder = game.attachAsset('border', {
anchorX: 0,
anchorY: 0,
width: 50,
height: 2732,
x: 1998,
y: 0
});
// Screen management
var currentScreen = null;
var mainMenu = null;
var gameScreen = null;
var thirdPage = null;
function showMainMenu() {
if (currentScreen) {
game.removeChild(currentScreen);
currentScreen.destroy();
}
mainMenu = new MainMenu();
currentScreen = mainMenu;
game.addChild(currentScreen);
}
function showGameScreen() {
if (currentScreen) {
game.removeChild(currentScreen);
currentScreen.destroy();
}
gameScreen = new GameScreen();
currentScreen = gameScreen;
game.addChild(currentScreen);
}
function showThirdPage() {
if (currentScreen) {
game.removeChild(currentScreen);
currentScreen.destroy();
}
thirdPage = new ThirdPage();
currentScreen = thirdPage;
game.addChild(currentScreen);
}
// Start with main menu
showMainMenu();
game.update = function () {
// Game logic updates handled by individual screens
}; ===================================================================
--- original.js
+++ change.js
@@ -616,8 +616,38 @@
headerText.anchor.set(0.5, 0);
headerText.x = 2048 / 2;
headerText.y = 100;
self.addChild(headerText);
+ // Market pause/start button to the left of star button
+ self.marketPaused = false;
+ var marketButton = new MenuButton('⏸️', 80, 80);
+ marketButton.x = headerText.x - 400; // Position to the left of star button
+ marketButton.y = headerText.y + 75; // Align vertically with header
+ marketButton.onPress = function () {
+ self.marketPaused = !self.marketPaused;
+ if (self.marketPaused) {
+ // Change button to play symbol
+ marketButton.removeChild(marketButton.children[1]); // Remove old text
+ var playButtonText = new Text2('▶️', {
+ size: 60,
+ fill: 0x000000
+ });
+ playButtonText.anchor.set(0.5, 0.5);
+ marketButton.addChild(playButtonText);
+ LK.effects.flashObject(marketButton, 0xFF0000, 300);
+ } else {
+ // Change button to pause symbol
+ marketButton.removeChild(marketButton.children[1]); // Remove old text
+ var pauseButtonText = new Text2('⏸️', {
+ size: 60,
+ fill: 0x000000
+ });
+ pauseButtonText.anchor.set(0.5, 0.5);
+ marketButton.addChild(pauseButtonText);
+ LK.effects.flashObject(marketButton, 0x00FF00, 300);
+ }
+ };
+ self.addChild(marketButton);
// Star button to the left of BORSA text
var starButton = new MenuButton('★', 80, 80);
starButton.x = headerText.x - 300; // Position further to the left of BORSA text
starButton.y = headerText.y + 75; // Align vertically with header
@@ -804,25 +834,29 @@
}
};
// Price fluctuation timer
self.priceTimer = LK.setInterval(function () {
- for (var i = 0; i < self.stocks.length; i++) {
- var stock = self.stocks[i];
- // Random price change between -10% to +10%
- var changePercent = (Math.random() - 0.5) * 0.2;
- var newPrice = stock.price * (1 + changePercent);
- // Enforce floor and ceiling limits
- stock.price = Math.max(stock.floorPrice, Math.min(stock.ceilingPrice, newPrice));
- storage['price_' + stock.name] = stock.price;
+ if (!self.marketPaused) {
+ for (var i = 0; i < self.stocks.length; i++) {
+ var stock = self.stocks[i];
+ // Random price change between -10% to +10%
+ var changePercent = (Math.random() - 0.5) * 0.2;
+ var newPrice = stock.price * (1 + changePercent);
+ // Enforce floor and ceiling limits
+ stock.price = Math.max(stock.floorPrice, Math.min(stock.ceilingPrice, newPrice));
+ storage['price_' + stock.name] = stock.price;
+ }
+ self.updateStockDisplay();
}
- self.updateStockDisplay();
}, 3000); // Update every 3 seconds
// 5-minute timer to update baseline prices for percentage calculation
self.fiveMinuteTimer = LK.setInterval(function () {
- for (var i = 0; i < self.stocks.length; i++) {
- var stock = self.stocks[i];
- stock.fiveMinutePrice = stock.price;
- storage['fiveMinPrice_' + stock.name] = stock.fiveMinutePrice;
+ if (!self.marketPaused) {
+ for (var i = 0; i < self.stocks.length; i++) {
+ var stock = self.stocks[i];
+ stock.fiveMinutePrice = stock.price;
+ storage['fiveMinPrice_' + stock.name] = stock.fiveMinutePrice;
+ }
}
}, 300000); // Update every 5 minutes (300000 ms)
// Question mark button in top right corner
var questionButton = new MenuButton('?', 80, 80);