User prompt
Sıfırlama düğmesini birazcık daha üstte götürün ve büyütün
User prompt
Sıfırlama düğmesi büyük olsun
User prompt
Bakiyenin çok üstüne "SIFIRLA" düğmesi ekle ve düğmeye bastığımız zaman "BAKİYE:" sıfırlansın
Code edit (1 edits merged)
Please save this source code
User prompt
Para Kazanma Yarışı
Initial prompt
orta büyük bir şekilde "BAŞLA!" düğmesi olsun. Düğmeye tıkladığımız zaman üstte 10 saniyelik süre başlasın."BAŞLA!" düğmesine bastığımız zaman "KAZAN!" düğmesi olsun. "KAZAN!" düğmesine her tıkladığımızda bize 20TL versin. Alttada "BAKİYE:" olsun. Her oyun bittiğinde o kazandığımız paralar toplanıp bakiyeye yazılsın.
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var EarnButton = Container.expand(function () {
var self = Container.call(this);
var buttonGraphics = self.attachAsset('earnButton', {
anchorX: 0.5,
anchorY: 0.5
});
var buttonText = new Text2('KAZAN!', {
size: 70,
fill: 0x000000
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.down = function (x, y, obj) {
LK.getSound('earn').play();
self.parent.earnMoney();
};
return self;
});
var StartButton = Container.expand(function () {
var self = Container.call(this);
var buttonGraphics = self.attachAsset('startButton', {
anchorX: 0.5,
anchorY: 0.5
});
var buttonText = new Text2('BAŞLA!', {
size: 80,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.down = function (x, y, obj) {
LK.getSound('click').play();
self.parent.startGame();
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x2196F3
});
/****
* Game Code
****/
var balance = storage.balance || 0;
var currentEarnings = 0;
var gameTime = 0;
var isGameActive = false;
var gameTimer = null;
var startButton = new StartButton();
startButton.x = 2048 / 2;
startButton.y = 2732 / 2;
game.addChild(startButton);
var earnButton = new EarnButton();
earnButton.x = 2048 / 2;
earnButton.y = 2732 / 2 + 50;
earnButton.visible = false;
game.addChild(earnButton);
var balanceText = new Text2('BAKİYE: ' + balance + ' TL', {
size: 60,
fill: 0xFFFFFF
});
balanceText.anchor.set(0.5, 1);
LK.gui.bottom.addChild(balanceText);
var timerText = new Text2('', {
size: 100,
fill: 0xFFFFFF
});
timerText.anchor.set(0.5, 0);
LK.gui.top.addChild(timerText);
var earningsText = new Text2('', {
size: 80,
fill: 0xFFD700
});
earningsText.anchor.set(0.5, 0.5);
earningsText.x = 2048 / 2;
earningsText.y = 2732 / 2 - 200;
earningsText.visible = false;
game.addChild(earningsText);
game.startGame = function () {
isGameActive = true;
gameTime = 10;
currentEarnings = 0;
startButton.visible = false;
earnButton.visible = true;
earningsText.visible = true;
earningsText.setText('0 TL');
gameTimer = LK.setInterval(function () {
gameTime--;
timerText.setText(gameTime + ' saniye');
if (gameTime <= 0) {
game.endGame();
}
}, 1000);
timerText.setText(gameTime + ' saniye');
};
game.earnMoney = function () {
if (!isGameActive) return;
currentEarnings += 20;
earningsText.setText(currentEarnings + ' TL');
tween(earnButton, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 100,
onFinish: function onFinish() {
tween(earnButton, {
scaleX: 1,
scaleY: 1
}, {
duration: 100
});
}
});
};
game.endGame = function () {
isGameActive = false;
LK.clearInterval(gameTimer);
balance += currentEarnings;
storage.balance = balance;
earnButton.visible = false;
earningsText.visible = false;
timerText.setText('');
balanceText.setText('BAKİYE: ' + balance + ' TL');
LK.getSound('timeUp').play();
tween(balanceText, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 300,
onFinish: function onFinish() {
tween(balanceText, {
scaleX: 1,
scaleY: 1
}, {
duration: 300
});
}
});
LK.setTimeout(function () {
startButton.visible = true;
}, 1000);
};
game.update = function () {
// Game update logic if needed
}; ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,158 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+var storage = LK.import("@upit/storage.v1");
+
+/****
+* Classes
+****/
+var EarnButton = Container.expand(function () {
+ var self = Container.call(this);
+ var buttonGraphics = self.attachAsset('earnButton', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ var buttonText = new Text2('KAZAN!', {
+ size: 70,
+ fill: 0x000000
+ });
+ buttonText.anchor.set(0.5, 0.5);
+ self.addChild(buttonText);
+ self.down = function (x, y, obj) {
+ LK.getSound('earn').play();
+ self.parent.earnMoney();
+ };
+ return self;
+});
+var StartButton = Container.expand(function () {
+ var self = Container.call(this);
+ var buttonGraphics = self.attachAsset('startButton', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ var buttonText = new Text2('BAŞLA!', {
+ size: 80,
+ fill: 0xFFFFFF
+ });
+ buttonText.anchor.set(0.5, 0.5);
+ self.addChild(buttonText);
+ self.down = function (x, y, obj) {
+ LK.getSound('click').play();
+ self.parent.startGame();
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x2196F3
+});
+
+/****
+* Game Code
+****/
+var balance = storage.balance || 0;
+var currentEarnings = 0;
+var gameTime = 0;
+var isGameActive = false;
+var gameTimer = null;
+var startButton = new StartButton();
+startButton.x = 2048 / 2;
+startButton.y = 2732 / 2;
+game.addChild(startButton);
+var earnButton = new EarnButton();
+earnButton.x = 2048 / 2;
+earnButton.y = 2732 / 2 + 50;
+earnButton.visible = false;
+game.addChild(earnButton);
+var balanceText = new Text2('BAKİYE: ' + balance + ' TL', {
+ size: 60,
+ fill: 0xFFFFFF
+});
+balanceText.anchor.set(0.5, 1);
+LK.gui.bottom.addChild(balanceText);
+var timerText = new Text2('', {
+ size: 100,
+ fill: 0xFFFFFF
+});
+timerText.anchor.set(0.5, 0);
+LK.gui.top.addChild(timerText);
+var earningsText = new Text2('', {
+ size: 80,
+ fill: 0xFFD700
+});
+earningsText.anchor.set(0.5, 0.5);
+earningsText.x = 2048 / 2;
+earningsText.y = 2732 / 2 - 200;
+earningsText.visible = false;
+game.addChild(earningsText);
+game.startGame = function () {
+ isGameActive = true;
+ gameTime = 10;
+ currentEarnings = 0;
+ startButton.visible = false;
+ earnButton.visible = true;
+ earningsText.visible = true;
+ earningsText.setText('0 TL');
+ gameTimer = LK.setInterval(function () {
+ gameTime--;
+ timerText.setText(gameTime + ' saniye');
+ if (gameTime <= 0) {
+ game.endGame();
+ }
+ }, 1000);
+ timerText.setText(gameTime + ' saniye');
+};
+game.earnMoney = function () {
+ if (!isGameActive) return;
+ currentEarnings += 20;
+ earningsText.setText(currentEarnings + ' TL');
+ tween(earnButton, {
+ scaleX: 1.1,
+ scaleY: 1.1
+ }, {
+ duration: 100,
+ onFinish: function onFinish() {
+ tween(earnButton, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 100
+ });
+ }
+ });
+};
+game.endGame = function () {
+ isGameActive = false;
+ LK.clearInterval(gameTimer);
+ balance += currentEarnings;
+ storage.balance = balance;
+ earnButton.visible = false;
+ earningsText.visible = false;
+ timerText.setText('');
+ balanceText.setText('BAKİYE: ' + balance + ' TL');
+ LK.getSound('timeUp').play();
+ tween(balanceText, {
+ scaleX: 1.2,
+ scaleY: 1.2
+ }, {
+ duration: 300,
+ onFinish: function onFinish() {
+ tween(balanceText, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 300
+ });
+ }
+ });
+ LK.setTimeout(function () {
+ startButton.visible = true;
+ }, 1000);
+};
+game.update = function () {
+ // Game update logic if needed
+};
\ No newline at end of file