User prompt
Yeni oluşturulan arka plan boyutu diger arkaplan boyutunun 4/1 ölçeğinde ve üst kısıma sabit
User prompt
Arkaplan için yeni bir katman ekle
User prompt
Zemini incelt
User prompt
Zemim varlıgını biraz incelt
User prompt
Zemini olabildigince incelt
User prompt
Bir zemin oluştur
User prompt
Arkaplan için resim varlıgı ekle
User prompt
Arka plan rengini degiştirebilmem için resim varlıgı ekle
User prompt
Bu alanda heryere gidebilen bir oyuncu ekle resim varlıklarıda ekle
User prompt
Arkaplan için varlık için resim varlıgı oluştur
User prompt
Oyındaki herşeyi sil ve sadece kahve rengi bir arkaplan istiyorum
Code edit (1 edits merged)
Please save this source code
User prompt
Toprak Saga - Soil Builder
Initial prompt
Toprak bir alan oluştur
/**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x8B4513 });
===================================================================
--- original.js
+++ change.js
@@ -1,451 +1,6 @@
-/****
-* Plugins
-****/
-var tween = LK.import("@upit/tween.v1");
-
-/****
-* Classes
-****/
-var HealthBar = Container.expand(function (maxValue) {
- var self = Container.call(this);
- var background = self.attachAsset('healthBarBg', {
- anchorX: 0,
- anchorY: 0
- });
- var bar = self.attachAsset('healthBar', {
- anchorX: 0,
- anchorY: 0
- });
- self.maxValue = maxValue || 100;
- self.currentValue = 0;
- self.setValue = function (value) {
- self.currentValue = Math.max(0, Math.min(self.maxValue, value));
- var scale = self.currentValue / self.maxValue;
- bar.scaleX = scale;
- if (scale > 0.7) {
- bar.tint = 0x32CD32;
- } else if (scale > 0.3) {
- bar.tint = 0xFFD700;
- } else {
- bar.tint = 0xFF4500;
- }
- };
- return self;
-});
-var OrganicMatter = Container.expand(function () {
- var self = Container.call(this);
- var graphics = self.attachAsset('organicMatter', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.speed = 2;
- self.collected = false;
- self.update = function () {
- if (!self.collected) {
- self.y += self.speed;
- }
- };
- self.collect = function () {
- self.collected = true;
- tween(self, {
- alpha: 0,
- scaleX: 0.1,
- scaleY: 0.1
- }, {
- duration: 300,
- onFinish: function onFinish() {
- self.destroy();
- }
- });
- };
- return self;
-});
-var Plant = Container.expand(function () {
- var self = Container.call(this);
- var graphics = self.attachAsset('plant', {
- anchorX: 0.5,
- anchorY: 1.0,
- scaleX: 0.1,
- scaleY: 0.1
- });
- self.health = 100;
- self.grown = false;
- tween(self, {
- scaleX: 1,
- scaleY: 1
- }, {
- duration: 2000,
- easing: tween.easeOut,
- onFinish: function onFinish() {
- self.grown = true;
- }
- });
- return self;
-});
-var Seed = Container.expand(function () {
- var self = Container.call(this);
- var graphics = self.attachAsset('seed', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.speed = 1.5;
- self.collected = false;
- self.update = function () {
- if (!self.collected) {
- self.y += self.speed;
- }
- };
- self.collect = function () {
- self.collected = true;
- tween(self, {
- alpha: 0,
- scaleX: 0.1,
- scaleY: 0.1
- }, {
- duration: 300,
- onFinish: function onFinish() {
- self.destroy();
- }
- });
- };
- return self;
-});
-var SoilPatch = Container.expand(function () {
- var self = Container.call(this);
- var soilGraphics = self.attachAsset('soil', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.fertility = 0;
- self.moisture = 50;
- self.nutrients = 30;
- self.plants = [];
- self.maxPlants = 4;
- self.addOrganic = function () {
- self.fertility = Math.min(100, self.fertility + 15);
- self.nutrients = Math.min(100, self.nutrients + 10);
- self.updateVisuals();
- };
- self.addWater = function () {
- self.moisture = Math.min(100, self.moisture + 20);
- self.updateVisuals();
- };
- self.updateVisuals = function () {
- if (self.fertility > 50) {
- soilGraphics.tint = 0x654321;
- } else {
- soilGraphics.tint = 0x8B4513;
- }
- };
- self.canPlant = function () {
- return self.plants.length < self.maxPlants && self.fertility > 30 && self.moisture > 20;
- };
- self.addPlant = function (x, y) {
- if (self.canPlant()) {
- var plant = new Plant();
- plant.x = x;
- plant.y = y;
- self.plants.push(plant);
- self.addChild(plant);
- return true;
- }
- return false;
- };
- self.update = function () {
- self.moisture = Math.max(0, self.moisture - 0.1);
- for (var i = 0; i < self.plants.length; i++) {
- if (self.moisture < 10) {
- self.plants[i].health = Math.max(0, self.plants[i].health - 0.5);
- }
- }
- };
- return self;
-});
-var WaterDrop = Container.expand(function () {
- var self = Container.call(this);
- var graphics = self.attachAsset('waterDrop', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.speed = 2.5;
- self.collected = false;
- self.update = function () {
- if (!self.collected) {
- self.y += self.speed;
- }
- };
- self.collect = function () {
- self.collected = true;
- tween(self, {
- alpha: 0,
- scaleX: 0.1,
- scaleY: 0.1
- }, {
- duration: 300,
- onFinish: function onFinish() {
- self.destroy();
- }
- });
- };
- return self;
-});
-
-/****
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x87CEEB
-});
-
-/****
-* Game Code
-****/
-var organicMaterials = [];
-var waterDrops = [];
-var seeds = [];
-var inventory = {
- organic: 0,
- water: 0,
- seeds: 0
-};
-var draggedItem = null;
-var draggedType = null;
-// Create main soil patch
-var mainSoil = game.addChild(new SoilPatch());
-mainSoil.x = 1024;
-mainSoil.y = 1366;
-// Create health indicators
-var moistureBar = new HealthBar(100);
-moistureBar.x = 100;
-moistureBar.y = 100;
-LK.gui.topLeft.addChild(moistureBar);
-var nutrientBar = new HealthBar(100);
-nutrientBar.x = 100;
-nutrientBar.y = 150;
-LK.gui.topLeft.addChild(nutrientBar);
-var fertilityBar = new HealthBar(100);
-fertilityBar.x = 100;
-fertilityBar.y = 200;
-LK.gui.topLeft.addChild(fertilityBar);
-// UI Labels
-var moistureLabel = new Text2('Moisture', {
- size: 30,
- fill: 0xFFFFFF
-});
-moistureLabel.x = 320;
-moistureLabel.y = 110;
-LK.gui.topLeft.addChild(moistureLabel);
-var nutrientLabel = new Text2('Nutrients', {
- size: 30,
- fill: 0xFFFFFF
-});
-nutrientLabel.x = 320;
-nutrientLabel.y = 160;
-LK.gui.topLeft.addChild(nutrientLabel);
-var fertilityLabel = new Text2('Fertility', {
- size: 30,
- fill: 0xFFFFFF
-});
-fertilityLabel.x = 320;
-fertilityLabel.y = 210;
-LK.gui.topLeft.addChild(fertilityLabel);
-// Inventory display
-var inventoryBg = LK.getAsset('healthBarBg', {
- width: 400,
- height: 100,
- x: 100,
- y: 2500
-});
-LK.gui.bottomLeft.addChild(inventoryBg);
-var organicText = new Text2('Organic: 0', {
- size: 40,
- fill: 0xFFFFFF
-});
-organicText.x = 120;
-organicText.y = 2520;
-LK.gui.bottomLeft.addChild(organicText);
-var waterText = new Text2('Water: 0', {
- size: 40,
- fill: 0xFFFFFF
-});
-waterText.x = 120;
-waterText.y = 2560;
-LK.gui.bottomLeft.addChild(waterText);
-var seedText = new Text2('Seeds: 0', {
- size: 40,
- fill: 0xFFFFFF
-});
-seedText.x = 300;
-seedText.y = 2520;
-LK.gui.bottomLeft.addChild(seedText);
-var scoreText = new Text2('Score: 0', {
- size: 50,
- fill: 0xFFFFFF
-});
-scoreText.anchor.set(0.5, 0);
-LK.gui.top.addChild(scoreText);
-function updateUI() {
- moistureBar.setValue(mainSoil.moisture);
- nutrientBar.setValue(mainSoil.nutrients);
- fertilityBar.setValue(mainSoil.fertility);
- organicText.setText('Organic: ' + inventory.organic);
- waterText.setText('Water: ' + inventory.water);
- seedText.setText('Seeds: ' + inventory.seeds);
- scoreText.setText('Score: ' + LK.getScore());
-}
-function spawnFallingItems() {
- if (LK.ticks % 120 == 0) {
- var rand = Math.random();
- var x = Math.random() * 1800 + 124;
- if (rand < 0.4) {
- var organic = new OrganicMatter();
- organic.x = x;
- organic.y = -50;
- organicMaterials.push(organic);
- game.addChild(organic);
- } else if (rand < 0.7) {
- var water = new WaterDrop();
- water.x = x;
- water.y = -50;
- waterDrops.push(water);
- game.addChild(water);
- } else {
- var seed = new Seed();
- seed.x = x;
- seed.y = -50;
- seeds.push(seed);
- game.addChild(seed);
- }
- }
-}
-function handleFallingItems() {
- for (var i = organicMaterials.length - 1; i >= 0; i--) {
- var organic = organicMaterials[i];
- if (organic.y > 2732) {
- organic.destroy();
- organicMaterials.splice(i, 1);
- }
- }
- for (var i = waterDrops.length - 1; i >= 0; i--) {
- var water = waterDrops[i];
- if (water.y > 2732) {
- water.destroy();
- waterDrops.splice(i, 1);
- }
- }
- for (var i = seeds.length - 1; i >= 0; i--) {
- var seed = seeds[i];
- if (seed.y > 2732) {
- seed.destroy();
- seeds.splice(i, 1);
- }
- }
-}
-game.down = function (x, y, obj) {
- // Check for falling items collection
- for (var i = organicMaterials.length - 1; i >= 0; i--) {
- var organic = organicMaterials[i];
- if (Math.abs(organic.x - x) < 40 && Math.abs(organic.y - y) < 40) {
- inventory.organic++;
- organic.collect();
- organicMaterials.splice(i, 1);
- return;
- }
- }
- for (var i = waterDrops.length - 1; i >= 0; i--) {
- var water = waterDrops[i];
- if (Math.abs(water.x - x) < 40 && Math.abs(water.y - y) < 40) {
- inventory.water++;
- water.collect();
- waterDrops.splice(i, 1);
- return;
- }
- }
- for (var i = seeds.length - 1; i >= 0; i--) {
- var seed = seeds[i];
- if (Math.abs(seed.x - x) < 40 && Math.abs(seed.y - y) < 40) {
- inventory.seeds++;
- seed.collect();
- seeds.splice(i, 1);
- return;
- }
- }
-};
-game.up = function (x, y, obj) {
- if (draggedItem && mainSoil.intersects({
- x: x,
- y: y,
- width: 1,
- height: 1
- })) {
- if (draggedType === 'organic' && inventory.organic > 0) {
- inventory.organic--;
- mainSoil.addOrganic();
- LK.setScore(LK.getScore() + 10);
- } else if (draggedType === 'water' && inventory.water > 0) {
- inventory.water--;
- mainSoil.addWater();
- LK.setScore(LK.getScore() + 5);
- } else if (draggedType === 'seed' && inventory.seeds > 0) {
- if (mainSoil.addPlant(x - mainSoil.x, y - mainSoil.y)) {
- inventory.seeds--;
- LK.setScore(LK.getScore() + 25);
- }
- }
- }
- if (draggedItem) {
- draggedItem.destroy();
- draggedItem = null;
- draggedType = null;
- }
-};
-game.move = function (x, y, obj) {
- if (draggedItem) {
- draggedItem.x = x;
- draggedItem.y = y;
- }
-};
-// Handle inventory item dragging
-LK.gui.bottomLeft.down = function (x, y, obj) {
- if (x > 120 && x < 250 && y > 2520 && y < 2560 && inventory.organic > 0) {
- draggedItem = game.addChild(LK.getAsset('organicMatter', {
- anchorX: 0.5,
- anchorY: 0.5
- }));
- draggedType = 'organic';
- draggedItem.x = x;
- draggedItem.y = y;
- draggedItem.alpha = 0.7;
- } else if (x > 120 && x < 250 && y > 2560 && y < 2600 && inventory.water > 0) {
- draggedItem = game.addChild(LK.getAsset('waterDrop', {
- anchorX: 0.5,
- anchorY: 0.5
- }));
- draggedType = 'water';
- draggedItem.x = x;
- draggedItem.y = y;
- draggedItem.alpha = 0.7;
- } else if (x > 300 && x < 430 && y > 2520 && y < 2560 && inventory.seeds > 0) {
- draggedItem = game.addChild(LK.getAsset('seed', {
- anchorX: 0.5,
- anchorY: 0.5
- }));
- draggedType = 'seed';
- draggedItem.x = x;
- draggedItem.y = y;
- draggedItem.alpha = 0.7;
- }
-};
-game.update = function () {
- spawnFallingItems();
- handleFallingItems();
- updateUI();
- // Check win condition
- if (mainSoil.plants.length >= 3 && mainSoil.fertility > 80) {
- LK.showYouWin();
- }
- // Check lose condition
- if (LK.ticks > 3600 && LK.getScore() < 100) {
- LK.showGameOver();
- }
-};
\ No newline at end of file
+ backgroundColor: 0x8B4513
+});
\ No newline at end of file
3d köstebek. In-Game asset. 2d. High contrast. No shadows
Elinde havuç olan kızgın bir çiftçi. Karakter ayakkabısı siyah
Havuç. In-Game asset. 2d. High contrast. No shadows
Bomba. In-Game asset. 2d. High contrast. No shadows
Alev. In-Game asset. 2d. High contrast. No shadows
Agız. In-Game asset. 2d. High contrast. No shadows
Kalp 3d. In-Game asset. 2d. High contrast. No shadows