Code edit (2 edits merged)
Please save this source code
User prompt
mağara daha sağda olsun
User prompt
cave biraz sağda olsun
Code edit (1 edits merged)
Please save this source code
User prompt
miner 80 elmas olsun
Code edit (3 edits merged)
Please save this source code
User prompt
balıkçının hızı daha fazla olsun
User prompt
göl yarım santimetre yukarıda olsun
User prompt
madencinin hızı 2kat fazla olsun
User prompt
balıkçının hızı 2 kat fazla olsun
User prompt
satın alınan ilk balıkçının hızı 2.5 olsun
User prompt
ilk balıkçının hızı 2.5 olsun
Code edit (1 edits merged)
Please save this source code
User prompt
balıkçı ve savaşçı biraz daha ileriden başlayıp bitirsin
User prompt
diamonds 0dan aşağı olamaz
User prompt
balıkçı 50 elmas değerinde olsun
User prompt
balıkçı 50 elmas olsun
Code edit (1 edits merged)
Please save this source code
User prompt
açlık bir bir artsın(1,2,3,4...), artma oranı için hızını ayarla
User prompt
açlık birer birer artsın, artma hızını ayarla
User prompt
başlangıçtaki ilk madencinin hızı fazla olsun
User prompt
buyButtonu biraz daha yukarı ve sağa al
User prompt
buyButtonu sol alta al
Code edit (1 edits merged)
Please save this source code
User prompt
madencinin hızını azalt
/**** * Classes ****/ // BuyFisherman Class var BuyFisherman = Container.expand(function () { var self = Container.call(this); self.attachAsset('buyFisherman', { anchorX: 0.5, anchorY: 0.5 }); self.down = function (x, y, obj) { if (diamonds >= 80) { diamonds -= 80; var newFisherman = new Fisherman(); newFisherman.x = tent.x; newFisherman.y = tent.y; game.addChild(newFisherman); var numFishermen = game.children.filter(function (child) { return child instanceof Fisherman; }).length; newFisherman.hungerReductionFactor = Math.max(1, 8 - (numFishermen - 1)); diamondText.setText('Diamonds: ' + diamonds); } }; }); // BuyMiner Class var BuyMiner = Container.expand(function () { var self = Container.call(this); self.attachAsset('buyMiner', { anchorX: 0.5, anchorY: 0.5 }); self.down = function (x, y, obj) { if (diamonds >= 100) { diamonds -= 100; var newMiner = new Miner(); newMiner.x = tent.x; newMiner.y = tent.y; game.addChild(newMiner); diamondText.setText('Diamonds: ' + diamonds); } }; }); // BuyWarrior Class var BuyWarrior = Container.expand(function () { var self = Container.call(this); self.attachAsset('buyWarrior', { anchorX: 0.5, anchorY: 0.5 }); self.down = function (x, y, obj) { if (diamonds >= 150) { diamonds -= 150; var newWarrior = new Warrior(); newWarrior.x = tent.x; newWarrior.y = tent.y; game.addChild(newWarrior); diamondText.setText('Diamonds: ' + diamonds); } }; }); // Cave Class var Cave = Container.expand(function () { var self = Container.call(this); self.attachAsset('cave', { anchorX: 0.5, anchorY: 0.5 }); }); // EnemyMonster Class var EnemyMonster = Container.expand(function () { var self = Container.call(this); self.attachAsset('enemyMonster', { anchorX: 0.5, anchorY: 0.5 }); self.enterBattleMode = function () { console.log("Enemy Monster is entering battle mode!"); // Battle mode logic eklenebilir }; }); // Fisherman Class var Fisherman = Container.expand(function () { var self = Container.call(this); self.attachAsset('fisherman', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 2; self.collecting = false; self.hungerReductionFactor = 6; self.update = function () { if (!self.collecting) { self.x += self.speed; if (self.x >= lake.x) { LK.getSound('fishingSound').play(); self.collecting = true; self.x = lake.x; } } else { self.x -= self.speed; if (self.x <= tent.x + 200) { self.collecting = false; self.x = tent.x + 200; miner.hunger = Math.max(0, miner.hunger - self.hungerReductionFactor); hungerText.setText('Hunger: ' + Math.max(0, Math.floor(miner.hunger))); } } }; }); // Miner Class var Miner = Container.expand(function () { var self = Container.call(this); self.attachAsset('miner', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 1.0; self.collecting = false; self.hunger = 0; self.update = function () { if (!self.collecting) { self.x += self.speed; if (self.x >= cave.x) { LK.getSound('pickaxeSound').play(); self.collecting = true; self.x = cave.x; collectDiamonds(); var numMiners = game.children.filter(function (child) { return child instanceof Miner; }).length; var numFishermen = game.children.filter(function (child) { return child instanceof Fisherman; }).length; var numWarriors = game.children.filter(function (child) { return child instanceof Warrior; }).length; self.hunger += 2.0 + 0.5 * (numMiners + numFishermen + numWarriors); if (self.hunger >= 100) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } } } else { self.x -= self.speed; if (self.x <= tent.x + 300) { self.collecting = false; self.x = tent.x + 300; LK.getSound('diamondDrop').play(); diamonds += 5; diamondText.setText('Diamonds: ' + diamonds); } } }; }); // Tent Class var Tent = Container.expand(function () { var self = Container.call(this); self.attachAsset('tent', { anchorX: 0.5, anchorY: 0.5 }); }); // Warrior Class var Warrior = Container.expand(function () { var self = Container.call(this); self.attachAsset('warrior', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 1; self.fighting = false; self.update = function () { if (!self.fighting) { self.x += self.speed; if (self.x >= enemyMonster.x) { self.fighting = true; self.x = enemyMonster.x; fightEnemies(); winTreasure(); } } else { self.x -= self.speed; if (self.x <= tent.x + 100) { self.fighting = false; self.x = tent.x + 100; } } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // Tek bir background ekliyoruz (duplicate olan kısım kaldırıldı) var background = LK.getAsset('backgroundImage', { anchorX: 0.5, anchorY: 0.5 }); background.x = 2048 / 2; background.y = 2732 / 2; game.addChild(background); // Buy Button: Arka planın üstünde görünsün diye background'dan sonra ekliyoruz var buyButton = LK.getAsset('buyButton', { anchorX: 0.5, anchorY: 0.5 }); buyButton.x = 0 + buyButton.width / 2; buyButton.y = 2732 - buyButton.height / 2; game.addChild(buyButton); buyButton.down = function (x, y, obj) { if (diamonds >= 700) { diamonds -= 700; game.children.forEach(function (child) { if (child instanceof Miner || child instanceof Fisherman || child instanceof Warrior) { child.speed += 0.5; } }); diamondText.setText('Diamonds: ' + diamonds); } }; // Ekstra butonların (buyMiner, buyFisherman, buyWarrior) ve diğer nesnelerin eklenmesi var buyMiner = game.addChild(new BuyMiner()); buyMiner.x = 2048 - 200; buyMiner.y = 2732 - 600 + 37.8; var buyFisherman = game.addChild(new BuyFisherman()); buyFisherman.x = buyMiner.x; buyFisherman.y = buyMiner.y + 150 + 37.8; var buyWarrior = game.addChild(new BuyWarrior()); buyWarrior.x = buyFisherman.x; buyWarrior.y = buyFisherman.y + 150 + 37.8; var buyWarriorPrice = new Text2('200 Diamonds', { size: 50, fill: 0xFFFFFF }); buyWarriorPrice.anchor.set(0.5, 0); LK.gui.top.addChild(buyWarriorPrice); buyWarriorPrice.x = buyWarrior.x + 150; buyWarriorPrice.y = buyWarrior.y; var tent = game.addChild(new Tent()); tent.x = 200; tent.y = 1366; var cave = game.addChild(new Cave()); cave.x = 1400; cave.y = 1366; var lake = game.addChild(LK.getAsset('lake', { anchorX: 0.5, anchorY: 0.5 })); lake.x = cave.x - 500; lake.y = cave.y + 600; var miner = game.addChild(new Miner()); miner.x = tent.x; miner.y = tent.y; var enemyMonster = game.addChild(new EnemyMonster()); enemyMonster.x = cave.x + 500; enemyMonster.y = cave.y; // Score ve Upgrade sistemi var diamonds = 0; var diamondText = new Text2('Diamonds: 0', { size: 100, fill: 0x000000 }); diamondText.anchor.set(0.5, 0); LK.gui.top.addChild(diamondText); diamondText.y = 50; var hungerText = new Text2('Hunger: 100', { size: 100, fill: 0x000000 }); hungerText.anchor.set(0.5, 0); LK.gui.top.addChild(hungerText); hungerText.y = 150; var treasureChest = LK.getAsset('treasureChest', { anchorX: 0.5, anchorY: 0.5 }); treasureChest.x = diamondText.x + 450; treasureChest.y = diamondText.y + 100; LK.gui.top.addChild(treasureChest); var treasureChestCount = 0; var treasureChestText = new Text2('x' + treasureChestCount, { size: 50, fill: 0x000000 }); treasureChestText.anchor.set(0.5, 0); treasureChestText.x = treasureChest.x + 150; treasureChestText.y = treasureChest.y; LK.gui.top.addChild(treasureChestText); // Fonksiyonlar function winTreasure() { console.log("Warrior has won a treasure chest!"); treasureChestCount += 1; treasureChestText.setText('x' + treasureChestCount); treasureChest.visible = true; if (treasureChestCount >= 100) { LK.showYouWin(); } } function fightEnemies() { console.log("Warrior is fighting enemies!"); // Savaş mantığı eklenebilir } function collectDiamonds() { // Diamond toplama mantığı eklenebilir } function upgradeTent() { if (diamonds >= 50) { diamonds -= 50; tent.attachAsset('upgradedTent', { anchorX: 0.5, anchorY: 0.5 }); diamondText.setText('Diamonds: ' + diamonds); } } // Upgrade butonuna dokunulduğunda game.down = function (x, y, obj) { if (x > 1800 && y < 200) { upgradeTent(); } }; // Arka plan müziğini çal LK.playMusic('background', { loop: true }); // Game update fonksiyonu game.update = function () { miner.update(); hungerText.setText('Hunger: ' + Math.max(0, Math.floor(miner.hunger))); if (LK.ticks % 1200 === 0) { LK.getSound('monsterRoar').play(); enemyMonster.enterBattleMode(); } };
===================================================================
--- original.js
+++ change.js
@@ -1,40 +1,38 @@
/****
* Classes
****/
-// Lake asset
+// BuyFisherman Class
var BuyFisherman = Container.expand(function () {
var self = Container.call(this);
- var buyFishermanGraphics = self.attachAsset('buyFisherman', {
+ self.attachAsset('buyFisherman', {
anchorX: 0.5,
anchorY: 0.5
});
self.down = function (x, y, obj) {
if (diamonds >= 80) {
- // Set the price for a fisherman to 80 diamonds
diamonds -= 80;
var newFisherman = new Fisherman();
newFisherman.x = tent.x;
newFisherman.y = tent.y;
game.addChild(newFisherman);
- // Decrease the hunger reduction factor for each new fisherman
var numFishermen = game.children.filter(function (child) {
return child instanceof Fisherman;
}).length;
newFisherman.hungerReductionFactor = Math.max(1, 8 - (numFishermen - 1));
diamondText.setText('Diamonds: ' + diamonds);
}
};
});
+// BuyMiner Class
var BuyMiner = Container.expand(function () {
var self = Container.call(this);
- var buyMinerGraphics = self.attachAsset('buyMiner', {
+ self.attachAsset('buyMiner', {
anchorX: 0.5,
anchorY: 0.5
});
self.down = function (x, y, obj) {
if (diamonds >= 100) {
- // Set the price for a miner to 100 diamonds
diamonds -= 100;
var newMiner = new Miner();
newMiner.x = tent.x;
newMiner.y = tent.y;
@@ -42,17 +40,17 @@
diamondText.setText('Diamonds: ' + diamonds);
}
};
});
+// BuyWarrior Class
var BuyWarrior = Container.expand(function () {
var self = Container.call(this);
- var buyWarriorGraphics = self.attachAsset('buyWarrior', {
+ self.attachAsset('buyWarrior', {
anchorX: 0.5,
anchorY: 0.5
});
self.down = function (x, y, obj) {
if (diamonds >= 150) {
- // Set the price for a warrior to 150 diamonds
diamonds -= 150;
var newWarrior = new Warrior();
newWarrior.x = tent.x;
newWarrior.y = tent.y;
@@ -60,82 +58,75 @@
diamondText.setText('Diamonds: ' + diamonds);
}
};
});
+// Cave Class
var Cave = Container.expand(function () {
var self = Container.call(this);
- var caveGraphics = self.attachAsset('cave', {
+ self.attachAsset('cave', {
anchorX: 0.5,
anchorY: 0.5
});
});
+// EnemyMonster Class
var EnemyMonster = Container.expand(function () {
var self = Container.call(this);
- var enemyMonsterGraphics = self.attachAsset('enemyMonster', {
+ self.attachAsset('enemyMonster', {
anchorX: 0.5,
anchorY: 0.5
});
- // Removed movement logic to keep the enemy monster stationary
- // Method to transition the enemy monster to battle mode
self.enterBattleMode = function () {
console.log("Enemy Monster is entering battle mode!");
- // Add logic for entering battle mode here
+ // Battle mode logic eklenebilir
};
});
-// Farmer class to represent the farmer character
+// Fisherman Class
var Fisherman = Container.expand(function () {
var self = Container.call(this);
- var fishermanGraphics = self.attachAsset('fisherman', {
+ self.attachAsset('fisherman', {
anchorX: 0.5,
anchorY: 0.5
});
- self.speed = 2; // Speed of the fisherman
- self.collecting = false; // Whether the fisherman is collecting fish
- self.hungerReductionFactor = 6; // Initial hunger reduction factor
- // Update function to move the fisherman
+ self.speed = 2;
+ self.collecting = false;
+ self.hungerReductionFactor = 6;
self.update = function () {
if (!self.collecting) {
self.x += self.speed;
if (self.x >= lake.x) {
- LK.getSound('fishingSound').play(); // Play fishing sound when fisherman reaches the lake
+ LK.getSound('fishingSound').play();
self.collecting = true;
self.x = lake.x;
- // No hunger decrease when reaching the lake
}
} else {
self.x -= self.speed;
if (self.x <= tent.x + 200) {
- // Start position further along the path by 200 units
self.collecting = false;
self.x = tent.x + 200;
- miner.hunger = Math.max(0, miner.hunger - self.hungerReductionFactor); // Decrease hunger level by factor, min 0
+ miner.hunger = Math.max(0, miner.hunger - self.hungerReductionFactor);
hungerText.setText('Hunger: ' + Math.max(0, Math.floor(miner.hunger)));
}
}
};
});
-//<Assets used in the game will automatically appear here>
-//<Write imports for supported plugins here>
-// Miner class to represent the miner character
+// Miner Class
var Miner = Container.expand(function () {
var self = Container.call(this);
- var minerGraphics = self.attachAsset('miner', {
+ self.attachAsset('miner', {
anchorX: 0.5,
anchorY: 0.5
});
- self.speed = 1.0; // Further reduced speed of the miner
- self.collecting = false; // Whether the miner is collecting diamonds
- self.hunger = 0; // Initial hunger level
- // Update function to move the miner
+ self.speed = 1.0;
+ self.collecting = false;
+ self.hunger = 0;
self.update = function () {
if (!self.collecting) {
self.x += self.speed;
if (self.x >= cave.x) {
- LK.getSound('pickaxeSound').play(); // Play pickaxe sound when miner reaches the cave
+ LK.getSound('pickaxeSound').play();
self.collecting = true;
self.x = cave.x;
collectDiamonds();
- // Calculate the number of miners, fishermen, and warriors
var numMiners = game.children.filter(function (child) {
return child instanceof Miner;
}).length;
var numFishermen = game.children.filter(function (child) {
@@ -143,56 +134,50 @@
}).length;
var numWarriors = game.children.filter(function (child) {
return child instanceof Warrior;
}).length;
- // Increase hunger level over time, faster with more characters
self.hunger += 2.0 + 0.5 * (numMiners + numFishermen + numWarriors);
if (self.hunger >= 100) {
- LK.effects.flashScreen(0xff0000, 1000); // Flash screen red
- LK.showGameOver(); // End the game
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.showGameOver();
}
}
- ;
} else {
self.x -= self.speed;
if (self.x <= tent.x + 300) {
- // Start position further along the path by 300 units
self.collecting = false;
self.x = tent.x + 300;
- // Play sound when miner reaches the tent with diamonds
LK.getSound('diamondDrop').play();
- // Increase diamond count when miner reaches the tent
- diamonds += 5; // Collect 5 diamonds per trip
+ diamonds += 5;
diamondText.setText('Diamonds: ' + diamonds);
}
}
};
});
-// Tent class to represent the starting point
+// Tent Class
var Tent = Container.expand(function () {
var self = Container.call(this);
- var tentGraphics = self.attachAsset('tent', {
+ self.attachAsset('tent', {
anchorX: 0.5,
anchorY: 0.5
});
});
+// Warrior Class
var Warrior = Container.expand(function () {
var self = Container.call(this);
- var warriorGraphics = self.attachAsset('warrior', {
+ self.attachAsset('warrior', {
anchorX: 0.5,
anchorY: 0.5
});
- self.speed = 1; // Speed of the warrior
- self.fighting = false; // Whether the warrior is fighting
- // Update function to move the warrior
+ self.speed = 1;
+ self.fighting = false;
self.update = function () {
if (!self.fighting) {
self.x += self.speed;
if (self.x >= enemyMonster.x) {
self.fighting = true;
self.x = enemyMonster.x;
fightEnemies();
- // Logic to win a treasure chest
winTreasure();
}
} else {
self.x -= self.speed;
@@ -207,163 +192,126 @@
/****
* Initialize Game
****/
var game = new LK.Game({
- backgroundColor: 0x000000 //Init game with black background
+ backgroundColor: 0x000000
});
/****
* Game Code
****/
-// Add a background image to the game
+// Tek bir background ekliyoruz (duplicate olan kısım kaldırıldı)
var background = LK.getAsset('backgroundImage', {
anchorX: 0.5,
anchorY: 0.5
});
-background.x = 2048 / 2; // Center horizontally
-background.y = 2732 / 2; // Center vertically
+background.x = 2048 / 2;
+background.y = 2732 / 2;
game.addChild(background);
+// Buy Button: Arka planın üstünde görünsün diye background'dan sonra ekliyoruz
var buyButton = LK.getAsset('buyButton', {
anchorX: 0.5,
anchorY: 0.5
});
-buyButton.x = 2048 - 200; // Align with other buttons
-buyButton.y = 2732 - 600 + 37.8 - 150; // Position above the buyMiner button
+buyButton.x = 0 + buyButton.width / 2;
+buyButton.y = 2732 - buyButton.height / 2;
game.addChild(buyButton);
buyButton.down = function (x, y, obj) {
if (diamonds >= 700) {
diamonds -= 700;
game.children.forEach(function (child) {
if (child instanceof Miner || child instanceof Fisherman || child instanceof Warrior) {
- child.speed += 0.5; // Increase speed by 0.5
+ child.speed += 0.5;
}
});
diamondText.setText('Diamonds: ' + diamonds);
}
};
+// Ekstra butonların (buyMiner, buyFisherman, buyWarrior) ve diğer nesnelerin eklenmesi
var buyMiner = game.addChild(new BuyMiner());
-buyMiner.x = 2048 - 200; // Position near the right edge of the screen
-buyMiner.y = 2732 - 600 + 37.8; // Move 1 cm lower on the screen
-var buyMiner = game.addChild(new BuyMiner());
-buyMiner.x = 2048 - 200; // Position near the right edge of the screen
-buyMiner.y = 2732 - 600 + 37.8; // Move 1 cm lower on the screen
+buyMiner.x = 2048 - 200;
+buyMiner.y = 2732 - 600 + 37.8;
var buyFisherman = game.addChild(new BuyFisherman());
buyFisherman.x = buyMiner.x;
-buyFisherman.y = buyMiner.y + 150 + 37.8; // Move 1 cm lower on the screen
+buyFisherman.y = buyMiner.y + 150 + 37.8;
var buyWarrior = game.addChild(new BuyWarrior());
buyWarrior.x = buyFisherman.x;
-buyWarrior.y = buyFisherman.y + 150 + 37.8; // Move 1 cm lower on the screen
-var buyMiner = game.addChild(new BuyMiner());
-buyMiner.x = 2048 - 200; // Position near the right edge of the screen
-buyMiner.y = 2732 - 600 + 37.8; // Move 1 cm lower on the screen
-var buyFisherman = game.addChild(new BuyFisherman());
-buyFisherman.x = buyMiner.x;
-buyFisherman.y = buyMiner.y + 150 + 37.8; // Move 1 cm lower on the screen
-var buyWarrior = game.addChild(new BuyWarrior());
-buyWarrior.x = buyFisherman.x;
-buyWarrior.y = buyFisherman.y + 150 + 37.8; // Move 1 cm lower on the screen
+buyWarrior.y = buyFisherman.y + 150 + 37.8;
var buyWarriorPrice = new Text2('200 Diamonds', {
size: 50,
fill: 0xFFFFFF
});
buyWarriorPrice.anchor.set(0.5, 0);
LK.gui.top.addChild(buyWarriorPrice);
-buyWarriorPrice.x = buyWarrior.x + 150; // Position to the right of the button
+buyWarriorPrice.x = buyWarrior.x + 150;
buyWarriorPrice.y = buyWarrior.y;
-var buyWarrior = game.addChild(new BuyWarrior());
-buyWarrior.x = buyFisherman.x;
-buyWarrior.y = buyFisherman.y + 150 + 37.8; // Move 1 cm lower on the screen
-var buyMiner = game.addChild(new BuyMiner());
-buyMiner.x = 2048 - 200; // Position near the right edge of the screen
-buyMiner.y = 2732 - 600 + 37.8; // Move 1 cm lower on the screen
-var buyFisherman = game.addChild(new BuyFisherman());
-buyFisherman.x = buyMiner.x;
-buyFisherman.y = buyMiner.y + 150 + 37.8; // Move 1 cm lower on the screen
var tent = game.addChild(new Tent());
tent.x = 200;
-tent.y = 1366; // Center vertically
-function winTreasure() {
- console.log("Warrior has won a treasure chest!");
- treasureChestCount += 1; // Increment the treasure chest count
- treasureChestText.setText('x' + treasureChestCount); // Update the text to show the count
- // Add logic to reward the player with a treasure chest
- treasureChest.visible = true; // Make the treasure chest visible
- // Check if the player has collected 100 treasure chests
- if (treasureChestCount >= 100) {
- LK.showYouWin(); // Show "you win" screen
- }
-}
-// Add a background image to the game
-var background = LK.getAsset('backgroundImage', {
- anchorX: 0.5,
- anchorY: 0.5
-});
-background.x = 2048 / 2; // Center horizontally
-background.y = 2732 / 2; // Center vertically
-game.addChild(background);
+tent.y = 1366;
var cave = game.addChild(new Cave());
-cave.x = 1400; // Move cave slightly more to the left
-cave.y = 1366; // Center vertically
+cave.x = 1400;
+cave.y = 1366;
var lake = game.addChild(LK.getAsset('lake', {
anchorX: 0.5,
anchorY: 0.5
}));
-lake.x = cave.x - 500; // Move lake slightly to the right
-lake.y = cave.y + 600; // Move lake further down
-var tent = game.addChild(new Tent());
-tent.x = 200;
-tent.y = 1366; // Center vertically
+lake.x = cave.x - 500;
+lake.y = cave.y + 600;
var miner = game.addChild(new Miner());
miner.x = tent.x;
miner.y = tent.y;
-// Score and upgrade system
+var enemyMonster = game.addChild(new EnemyMonster());
+enemyMonster.x = cave.x + 500;
+enemyMonster.y = cave.y;
+// Score ve Upgrade sistemi
var diamonds = 0;
var diamondText = new Text2('Diamonds: 0', {
size: 100,
fill: 0x000000
});
diamondText.anchor.set(0.5, 0);
LK.gui.top.addChild(diamondText);
-diamondText.y = 50; // Add some space below the diamond text
+diamondText.y = 50;
var hungerText = new Text2('Hunger: 100', {
size: 100,
fill: 0x000000
});
hungerText.anchor.set(0.5, 0);
LK.gui.top.addChild(hungerText);
-hungerText.y = 150; // Position the hunger text further down
-// Add treasure chest asset next to diamond and hunger indicators
+hungerText.y = 150;
var treasureChest = LK.getAsset('treasureChest', {
anchorX: 0.5,
anchorY: 0.5
});
-treasureChest.x = diamondText.x + 450; // Move treasure chest slightly to the left
-treasureChest.y = diamondText.y + 100; // Move treasure chest further down from the diamond text
+treasureChest.x = diamondText.x + 450;
+treasureChest.y = diamondText.y + 100;
LK.gui.top.addChild(treasureChest);
-// Initialize treasure chest count
var treasureChestCount = 0;
-// Display the number of treasure chests collected
var treasureChestText = new Text2('x' + treasureChestCount, {
size: 50,
fill: 0x000000
});
treasureChestText.anchor.set(0.5, 0);
-treasureChestText.x = treasureChest.x + 150; // Position further to the right of the treasure chest
+treasureChestText.x = treasureChest.x + 150;
treasureChestText.y = treasureChest.y;
LK.gui.top.addChild(treasureChestText);
-// Function to handle fighting enemies
+// Fonksiyonlar
+function winTreasure() {
+ console.log("Warrior has won a treasure chest!");
+ treasureChestCount += 1;
+ treasureChestText.setText('x' + treasureChestCount);
+ treasureChest.visible = true;
+ if (treasureChestCount >= 100) {
+ LK.showYouWin();
+ }
+}
function fightEnemies() {
console.log("Warrior is fighting enemies!");
- // Add logic for fighting enemies here
+ // Savaş mantığı eklenebilir
}
-// Function to collect fish
-function collectFish() {
- miner.hunger = Math.min(100, miner.hunger + 10); // Increase hunger level by 10, max 100
- hungerText.setText('Hunger: ' + Math.max(0, Math.floor(miner.hunger)));
+function collectDiamonds() {
+ // Diamond toplama mantığı eklenebilir
}
-// Function to collect diamonds
-function collectDiamonds() {}
-// Upgrade system
function upgradeTent() {
if (diamonds >= 50) {
diamonds -= 50;
tent.attachAsset('upgradedTent', {
@@ -372,87 +320,23 @@
});
diamondText.setText('Diamonds: ' + diamonds);
}
}
-// Event listener for upgrades
+// Upgrade butonuna dokunulduğunda
game.down = function (x, y, obj) {
if (x > 1800 && y < 200) {
- // Assume upgrade button is at top-right
upgradeTent();
}
};
-// Initialize the BuyMiner button
-var buyMiner = game.addChild(new BuyMiner());
-buyMiner.x = 2048 - 200; // Position near the right edge of the screen
-buyMiner.y = 2732 - 600 + 37.8; // Move 1 cm lower on the screen
-var buyMinerPrice = new Text2('100 Diamonds', {
- size: 50,
- fill: 0xFFFFFF
-});
-var buyButton = LK.getAsset('buyButton', {
- anchorX: 0.5,
- anchorY: 0.5
-});
-buyMinerPrice.anchor.set(0.5, 0);
-LK.gui.top.addChild(buyMinerPrice);
-buyMinerPrice.x = buyMiner.x + 150; // Position to the right of the button
-buyMinerPrice.y = buyMiner.y;
-var buyFisherman = game.addChild(new BuyFisherman());
-buyFisherman.x = buyMiner.x;
-buyFisherman.y = buyMiner.y + 150 + 37.8; // Move 1 cm lower on the screen
-var buyFishermanPrice = new Text2('150 Diamonds', {
- size: 50,
- fill: 0xFFFFFF
-});
-buyFishermanPrice.anchor.set(0.5, 0);
-LK.gui.top.addChild(buyFishermanPrice);
-buyFishermanPrice.x = buyFisherman.x + 150; // Position to the right of the button
-buyFishermanPrice.y = buyFisherman.y;
-var buyWarrior = game.addChild(new BuyWarrior());
-buyWarrior.x = buyFisherman.x;
-buyWarrior.y = buyFisherman.y + 150 + 37.8; // Move 1 cm lower on the screen
-var buyWarriorPrice = new Text2('200 Diamonds', {
- size: 50,
- fill: 0xFFFFFF
-});
-buyWarriorPrice.anchor.set(0.5, 0);
-LK.gui.top.addChild(buyWarriorPrice);
-buyWarriorPrice.x = buyWarrior.x + 150; // Position to the right of the button
-buyWarriorPrice.y = buyWarrior.y;
-var buyMinerPrice = new Text2('100 Diamonds', {
- size: 50,
- fill: 0xFFFFFF
-});
-buyMinerPrice.anchor.set(0.5, 0);
-LK.gui.top.addChild(buyMinerPrice);
-var buyFisherman = game.addChild(new BuyFisherman());
-var buyFishermanPrice = new Text2('150 Diamonds', {
- size: 50,
- fill: 0xFFFFFF
-});
-buyFishermanPrice.anchor.set(0.5, 0);
-LK.gui.top.addChild(buyFishermanPrice);
-var buyWarrior = game.addChild(new BuyWarrior());
-var buyWarriorPrice = new Text2('200 Diamonds', {
- size: 50,
- fill: 0xFFFFFF
-});
-buyWarriorPrice.anchor.set(0.5, 0);
-LK.gui.top.addChild(buyWarriorPrice);
-var enemyMonster = game.addChild(new EnemyMonster());
-enemyMonster.x = cave.x + 500; // Move slightly to the left
-enemyMonster.y = cave.y; // Align vertically with the cave
-// Play background music in a loop
+// Arka plan müziğini çal
LK.playMusic('background', {
loop: true
});
-// Update function for game logic
+// Game update fonksiyonu
game.update = function () {
miner.update();
hungerText.setText('Hunger: ' + Math.max(0, Math.floor(miner.hunger)));
- // Check if it's time for the enemy monster to make a sound and enter battle mode
if (LK.ticks % 1200 === 0) {
- // Every 20 seconds at 60 FPS
- LK.getSound('monsterRoar').play(); // Play monster roar sound
- enemyMonster.enterBattleMode(); // Transition to battle mode
+ LK.getSound('monsterRoar').play();
+ enemyMonster.enterBattleMode();
}
};
\ No newline at end of file
madenci çizgi karakter. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
balıkçı animasyon şeklinde. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
savaşçı karikatür şeklinde. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
hazine kutusu. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
light green
yuvarlak balıklı göl. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
kırmızı buton. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
"Collect 100 treasure chests as soon as possible." text. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
orman evi No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat