User prompt
Please fix the bug: 'TypeError: populationText.getText is not a function' in or related to this line: 'var currentPopulation = parseInt(populationText.getText().split(': ')[1]);' Line Number: 2350
User prompt
karar puntolarını 5 artır. sağlık 50'nin altına düştüğünde nüfus azalmaya başlasın 30'un altına düşerse günde 10 kişi ölsün
User prompt
oyun 200 senaryo daha ekle
User prompt
puse menüsüne yeni oyun seçeneği ekle
User prompt
oyuna her başladığında karşına çıkan senaryoların sırası değişsin. oyuna sonraki seçenekleri etkileyebilecek kararlar ekle. daha önceden vermiş olduğun kararların bazıları sonraki senaryoları tetiklesin ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
giriş yazısını ortala
User prompt
giriş tetinin puntosu çok daha büyük olsun ve tıklayarak geçilsin süreyle değil
User prompt
oyunun başında senaryoyu ekle
User prompt
statlardan biri 0 olduğunda oyun bitsin. oyunun başlangıcına nasıl bir evrende ve durumda olduğumuzu belirten biir giriş notu ekle
User prompt
5 punto daha büyüt tüm yazıları
User prompt
yazıların puntosunu 5 büyüt
User prompt
yazıları 2 punto büyüt ve senaryoları birazcık daha yukarıya konumla
User prompt
türkçe yap
User prompt
Please fix the bug: 'Cannot set properties of undefined (setting 'wordWrap')' in or related to this line: 'descriptionText.style.wordWrap = true;' Line Number: 81
Code edit (1 edits merged)
Please save this source code
User prompt
Bunker Leader: Post-Apocalyptic Survival Decisions
Initial prompt
Kıyamet sonrası hayatta kalma temalı bir swipe karar oyunu oluşturmak istiyorum. Oyuncu, nükleer savaş sonrası 300 kişilik bir sığınağın lideri olarak kararlar alacak. Her sahnede oyuncuya bir olay sunulacak. Oyuncu iki seçenekten birini sağa ya da sola kaydırarak seçecek. Her seçim, topluluğun moralini, kaynaklarını, güvenliğini, sağlığını ve umudunu olumlu ya da olumsuz etkileyebilir. Oyunun dili sade, anlaşılır ve etkileyici olmalı. Oyun, kısa olaylarla ilerlemeli. Her olay aşağıdaki formatta sunulmalı: 1. **Olay**: Oyuncuya sunulan durum, kısa ve net şekilde anlatılmalı. (En fazla 2-3 cümle) 2. **Seçenek A ve B**: İki farklı karar seçeneği. Oyuncu bunlardan birini seçecek. 3. **Sonuç A ve B**: Seçime göre ortaya çıkan sonuç. 4. **Stat Etkisi**: Moral, Erzak, Enerji, Umut gibi değerlerdeki değişim. Bu yapıdaki her olay birbirinden bağımsız olmalı ama genel atmosfer aynı kalmalı: kıyamet sonrası, sınırlı kaynaklar, insani ikilemler. Lütfen bu formatta 5 farklı karar noktası üret.
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var OptionCard = Container.expand(function () {
var self = Container.call(this);
var background = self.attachAsset('optionCard', {
anchorX: 0.5,
anchorY: 0.5
});
var optionText = new Text2('', {
size: 40,
fill: 0xFFFFFF,
wordWrap: true,
wordWrapWidth: 720
});
optionText.anchor.set(0.5, 0.5);
optionText.x = 0;
optionText.y = -50;
self.addChild(optionText);
var effectsText = new Text2('', {
size: 34,
fill: 0xAAAAAA,
wordWrap: true,
wordWrapWidth: 720
});
effectsText.anchor.set(0.5, 0.5);
effectsText.x = 0;
effectsText.y = 80;
self.addChild(effectsText);
self.setOption = function (option) {
optionText.setText(option.text);
var effectsStr = '';
for (var key in option.effects) {
var value = option.effects[key];
var symbol = value > 0 ? '+' : '';
effectsStr += key + ': ' + symbol + value + '\n';
}
effectsText.setText(effectsStr);
};
return self;
});
var ScenarioCard = Container.expand(function () {
var self = Container.call(this);
var background = self.attachAsset('scenarioCard', {
anchorX: 0.5,
anchorY: 0.5
});
var titleText = new Text2('', {
size: 60,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0);
titleText.x = 0;
titleText.y = -550;
self.addChild(titleText);
var descriptionText = new Text2('', {
size: 44,
fill: 0xCCCCCC,
wordWrap: true,
wordWrapWidth: 1600
});
descriptionText.anchor.set(0.5, 0);
descriptionText.x = 0;
descriptionText.y = -450;
self.addChild(descriptionText);
var leftOption = self.addChild(new OptionCard());
leftOption.x = -400;
leftOption.y = 200;
var rightOption = self.addChild(new OptionCard());
rightOption.x = 400;
rightOption.y = 200;
var swipeLeft = self.attachAsset('swipeIndicator', {
anchorX: 0.5,
anchorY: 0.5
});
swipeLeft.x = -400;
swipeLeft.y = 450;
swipeLeft.alpha = 0.5;
var swipeRight = self.attachAsset('swipeIndicator', {
anchorX: 0.5,
anchorY: 0.5
});
swipeRight.x = 400;
swipeRight.y = 450;
swipeRight.alpha = 0.5;
self.setScenario = function (scenario) {
titleText.setText(scenario.title);
descriptionText.setText(scenario.description);
leftOption.setOption(scenario.leftOption);
rightOption.setOption(scenario.rightOption);
};
self.getLeftOption = function () {
return leftOption;
};
self.getRightOption = function () {
return rightOption;
};
return self;
});
var StatBar = Container.expand(function (statName, color) {
var self = Container.call(this);
var background = self.attachAsset('statBar', {
anchorX: 0,
anchorY: 0
});
var fill = self.attachAsset('statFill', {
anchorX: 0,
anchorY: 0
});
fill.tint = color;
var label = new Text2(statName, {
size: 36,
fill: 0xFFFFFF
});
label.anchor.set(0, 0.5);
label.x = 310;
label.y = 20;
self.addChild(label);
var valueText = new Text2('100', {
size: 36,
fill: 0xFFFFFF
});
valueText.anchor.set(1, 0.5);
valueText.x = 550;
valueText.y = 20;
self.addChild(valueText);
self.setValue = function (value) {
fill.scaleX = Math.max(0, Math.min(1, value / 100));
valueText.setText(Math.round(value).toString());
if (value < 30) {
fill.tint = 0xff0000;
} else if (value < 60) {
fill.tint = 0xffff00;
} else {
fill.tint = color;
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1a1a1a
});
/****
* Game Code
****/
var stats = {
morale: 100,
resources: 100,
security: 100,
health: 100,
hope: 100
};
var scenarios = [{
title: "Yiyecek Kıtlığı Krizi",
description: "Sığınağın yiyecek malzemeleri tehlikeli derecede azaldı. Bir avcı grubu sınırlı malzemelerle geri döndü, ancak herkes için yeterli değil.",
leftOption: {
text: "Yiyeceği 300 kişi arasında eşit olarak paylaştır",
effects: {
morale: -10,
resources: -5,
health: -15,
hope: 5
}
},
rightOption: {
text: "Temel işçiler için yiyeceği öncelendir",
effects: {
morale: -20,
resources: 10,
security: 5,
health: -5
}
}
}, {
title: "Tıbbi Malzeme İkilemi",
description: "Bir çocuk kritik durumda ve ilaç gerekiyor. Aynı ilaç, hafif rahatsızlıkları olan birkaç yetişkini tedavi etmek için kullanılabilir.",
leftOption: {
text: "Tüm mevcut ilaçla çocuğu kurtar",
effects: {
morale: 15,
health: -10,
hope: 10
}
},
rightOption: {
text: "Bunun yerine birçok yetişkini tedavi et",
effects: {
morale: -15,
health: 20,
hope: -10
}
}
}, {
title: "Güvenlik İhlali",
description: "Sığınak girişi yakınında bilinmeyen figürler görüldü. Güvenlik ekibiniz araştırma için izin istiyor, ancak bu açığa çıkma riskini taşıyor.",
leftOption: {
text: "Güvenlik ekibini araştırmaya gönder",
effects: {
security: 15,
resources: -10,
morale: -5
}
},
rightOption: {
text: "Gizli kal ve bekle",
effects: {
security: -10,
morale: -10,
hope: -5
}
}
}, {
title: "Enerji Tasarrufu",
description: "Sığınağın elektrik şebekesi arızalanıyor. Yaşam alanlarını ısıtmak ile su filtreleme sistemini sürdürmek arasında seçim yapmalısın.",
leftOption: {
text: "Konfor için ısıtmaya öncelik ver",
effects: {
morale: 10,
health: -15,
resources: -10
}
},
rightOption: {
text: "Su filtreleme sistemini sürdür",
effects: {
morale: -15,
health: 15,
resources: 5
}
}
}, {
title: "Kaynak Keşfi",
description: "İzciler terk edilmiş bir malzeme deposu buldular, ancak onu geri almak en iyi avcılarının hayatını riske atmayı gerektiriyor.",
leftOption: {
text: "Avcı ekibini gönder",
effects: {
resources: 25,
security: -10,
morale: -5
}
},
rightOption: {
text: "Güvenli oyna ve yerinde kal",
effects: {
resources: -5,
security: 5,
morale: 5
}
}
}];
var currentScenarioIndex = 0;
var scenarioCard;
var statBars = {};
var isDragging = false;
var dragStartX = 0;
var cardStartX = 0;
var isProcessingChoice = false;
// Create UI elements
var background = game.attachAsset('bunkerBackground', {
anchorX: 0,
anchorY: 0
});
// Create stat bars
var statNames = ['Moral', 'Kaynaklar', 'Güvenlik', 'Sağlık', 'Umut'];
var statColors = [0x00ff00, 0x0080ff, 0xff8000, 0xff0080, 0xffff00];
var statKeys = ['morale', 'resources', 'security', 'health', 'hope'];
for (var i = 0; i < statNames.length; i++) {
var statBar = new StatBar(statNames[i], statColors[i]);
statBar.x = 100;
statBar.y = 100 + i * 60;
statBars[statKeys[i]] = statBar;
game.addChild(statBar);
}
// Create scenario card
scenarioCard = new ScenarioCard();
scenarioCard.x = 1024;
scenarioCard.y = 1500;
game.addChild(scenarioCard);
// Introduction text
var introText = new Text2('Yıl 2087: Nükleer savaş sonrası dünyada yer altı sığınağında 300 kişilik topluluğun liderisiniz. Her kararınız toplumun geleceğini belirler. Moralinizi, kaynaklarınızı, güvenliğinizi, sağlığınızı ve umudunuzu dengede tutun.', {
size: 80,
fill: 0xFFFFFF,
wordWrap: true,
wordWrapWidth: 1800
});
introText.anchor.set(0.5, 0);
introText.x = 1024;
introText.y = 500;
game.addChild(introText);
// Add click handler to introduction text
introText.down = function (x, y, obj) {
// Hide introduction text immediately
tween(introText, {
alpha: 0
}, {
duration: 500,
easing: tween.easeOut
});
// Show first scenario
scenarioCard.alpha = 1;
loadScenario();
};
// Population counter
var populationText = new Text2('Nüfus: 300', {
size: 48,
fill: 0xFFFFFF
});
populationText.anchor.set(0.5, 0);
populationText.x = 1024;
populationText.y = 50;
game.addChild(populationText);
// Day counter
var dayCounter = 1;
var dayText = new Text2('Gün ' + dayCounter, {
size: 48,
fill: 0xFFFFFF
});
dayText.anchor.set(1, 0);
dayText.x = 1900;
dayText.y = 50;
game.addChild(dayText);
function updateStats() {
for (var key in statBars) {
statBars[key].setValue(stats[key]);
}
}
function loadScenario() {
if (currentScenarioIndex >= scenarios.length) {
currentScenarioIndex = 0; // Loop back to beginning
}
var scenario = scenarios[currentScenarioIndex];
scenarioCard.setScenario(scenario);
// Reset card position
scenarioCard.x = 1024;
scenarioCard.alpha = 1;
// Introduction text hiding is now handled by click event
// Animate card appearance
tween(scenarioCard, {
y: 1500
}, {
duration: 500,
easing: tween.easeOut
});
}
function makeChoice(isLeft) {
if (isProcessingChoice) return;
isProcessingChoice = true;
var scenario = scenarios[currentScenarioIndex];
var choice = isLeft ? scenario.leftOption : scenario.rightOption;
// Apply effects
var hasPositiveEffect = false;
var hasNegativeEffect = false;
for (var key in choice.effects) {
var effect = choice.effects[key];
stats[key] += effect;
stats[key] = Math.max(0, Math.min(100, stats[key]));
if (effect > 0) hasPositiveEffect = true;
if (effect < 0) hasNegativeEffect = true;
}
// Play appropriate sound
if (hasPositiveEffect && !hasNegativeEffect) {
LK.getSound('positive').play();
} else if (hasNegativeEffect && !hasPositiveEffect) {
LK.getSound('negative').play();
} else {
LK.getSound('decision').play();
}
// Animate card exit
var targetX = isLeft ? -1000 : 3000;
tween(scenarioCard, {
x: targetX,
alpha: 0
}, {
duration: 300,
easing: tween.easeIn,
onFinish: function onFinish() {
currentScenarioIndex++;
dayCounter++;
dayText.setText('Gün ' + dayCounter);
// Check for game over conditions
for (var key in stats) {
if (stats[key] <= 0) {
LK.showGameOver();
return;
}
}
// Check for victory condition
var allStatsGood = true;
for (var key in stats) {
if (stats[key] < 80) {
allStatsGood = false;
break;
}
}
if (allStatsGood && dayCounter >= 30) {
LK.showYouWin();
return;
}
updateStats();
loadScenario();
isProcessingChoice = false;
}
});
}
game.down = function (x, y, obj) {
if (isProcessingChoice) return;
isDragging = true;
dragStartX = x;
cardStartX = scenarioCard.x;
};
game.move = function (x, y, obj) {
if (isDragging && !isProcessingChoice) {
var deltaX = x - dragStartX;
scenarioCard.x = cardStartX + deltaX;
// Visual feedback
var swipeThreshold = 300;
if (Math.abs(deltaX) > swipeThreshold) {
if (deltaX > 0) {
scenarioCard.getLeftOption().alpha = 0.5;
scenarioCard.getRightOption().alpha = 1;
} else {
scenarioCard.getLeftOption().alpha = 1;
scenarioCard.getRightOption().alpha = 0.5;
}
} else {
scenarioCard.getLeftOption().alpha = 1;
scenarioCard.getRightOption().alpha = 1;
}
}
};
game.up = function (x, y, obj) {
if (isDragging && !isProcessingChoice) {
isDragging = false;
var deltaX = x - dragStartX;
var swipeThreshold = 300;
if (Math.abs(deltaX) > swipeThreshold) {
if (deltaX > 0) {
makeChoice(false); // Right choice
} else {
makeChoice(true); // Left choice
}
} else {
// Snap back to center
tween(scenarioCard, {
x: 1024
}, {
duration: 200,
easing: tween.easeOut
});
}
// Reset option opacity
scenarioCard.getLeftOption().alpha = 1;
scenarioCard.getRightOption().alpha = 1;
}
};
// Initialize game
updateStats();
// Show introduction text at start
introText.alpha = 1;
// Hide scenario card initially
scenarioCard.alpha = 0;
scenarioCard.y = 2732; // Position off-screen
// First scenario will be loaded when introduction text is clicked ===================================================================
--- original.js
+++ change.js
@@ -287,17 +287,30 @@
scenarioCard.y = 1500;
game.addChild(scenarioCard);
// Introduction text
var introText = new Text2('Yıl 2087: Nükleer savaş sonrası dünyada yer altı sığınağında 300 kişilik topluluğun liderisiniz. Her kararınız toplumun geleceğini belirler. Moralinizi, kaynaklarınızı, güvenliğinizi, sağlığınızı ve umudunuzu dengede tutun.', {
- size: 36,
+ size: 80,
fill: 0xFFFFFF,
wordWrap: true,
wordWrapWidth: 1800
});
introText.anchor.set(0.5, 0);
introText.x = 1024;
introText.y = 500;
game.addChild(introText);
+// Add click handler to introduction text
+introText.down = function (x, y, obj) {
+ // Hide introduction text immediately
+ tween(introText, {
+ alpha: 0
+ }, {
+ duration: 500,
+ easing: tween.easeOut
+ });
+ // Show first scenario
+ scenarioCard.alpha = 1;
+ loadScenario();
+};
// Population counter
var populationText = new Text2('Nüfus: 300', {
size: 48,
fill: 0xFFFFFF
@@ -329,17 +342,9 @@
scenarioCard.setScenario(scenario);
// Reset card position
scenarioCard.x = 1024;
scenarioCard.alpha = 1;
- // Hide introduction text when first scenario loads
- if (currentScenarioIndex === 0 && dayCounter === 1) {
- tween(introText, {
- alpha: 0
- }, {
- duration: 500,
- easing: tween.easeOut
- });
- }
+ // Introduction text hiding is now handled by click event
// Animate card appearance
tween(scenarioCard, {
y: 1500
}, {
@@ -464,9 +469,5 @@
introText.alpha = 1;
// Hide scenario card initially
scenarioCard.alpha = 0;
scenarioCard.y = 2732; // Position off-screen
-// Load first scenario after a delay
-LK.setTimeout(function () {
- scenarioCard.alpha = 1;
- loadScenario();
-}, 3000);
\ No newline at end of file
+// First scenario will be loaded when introduction text is clicked
\ No newline at end of file