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: 28,
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: 22,
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: 48,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0);
titleText.x = 0;
titleText.y = -550;
self.addChild(titleText);
var descriptionText = new Text2('', {
size: 32,
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: 24,
fill: 0xFFFFFF
});
label.anchor.set(0, 0.5);
label.x = 310;
label.y = 20;
self.addChild(label);
var valueText = new Text2('100', {
size: 24,
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: "Food Shortage Crisis",
description: "The bunker's food supplies are running dangerously low. A group of scavengers has returned with limited supplies, but there's not enough for everyone.",
leftOption: {
text: "Ration food equally among all 300 people",
effects: {
morale: -10,
resources: -5,
health: -15,
hope: 5
}
},
rightOption: {
text: "Prioritize food for essential workers",
effects: {
morale: -20,
resources: 10,
security: 5,
health: -5
}
}
}, {
title: "Medical Supply Dilemma",
description: "A child is critically ill and needs medication. The same medicine could be used to treat several adults with minor ailments.",
leftOption: {
text: "Save the child with all available medicine",
effects: {
morale: 15,
health: -10,
hope: 10
}
},
rightOption: {
text: "Treat the many adults instead",
effects: {
morale: -15,
health: 20,
hope: -10
}
}
}, {
title: "Security Breach",
description: "Unknown figures have been spotted near the bunker entrance. Your security team requests permission to investigate, but it risks exposure.",
leftOption: {
text: "Send security team to investigate",
effects: {
security: 15,
resources: -10,
morale: -5
}
},
rightOption: {
text: "Remain hidden and wait",
effects: {
security: -10,
morale: -10,
hope: -5
}
}
}, {
title: "Power Conservation",
description: "The bunker's power grid is failing. You must choose between heating the living quarters or maintaining the water filtration system.",
leftOption: {
text: "Prioritize heating for comfort",
effects: {
morale: 10,
health: -15,
resources: -10
}
},
rightOption: {
text: "Maintain water filtration",
effects: {
morale: -15,
health: 15,
resources: 5
}
}
}, {
title: "Resource Discovery",
description: "Scouts have found an abandoned supply cache, but retrieving it would require risking the lives of your best scavengers.",
leftOption: {
text: "Send the scavenging team",
effects: {
resources: 25,
security: -10,
morale: -5
}
},
rightOption: {
text: "Play it safe and stay put",
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 = ['Morale', 'Resources', 'Security', 'Health', 'Hope'];
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 = 1600;
game.addChild(scenarioCard);
// Population counter
var populationText = new Text2('Population: 300', {
size: 36,
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('Day ' + dayCounter, {
size: 36,
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;
// Animate card appearance
tween(scenarioCard, {
y: 1600
}, {
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('Day ' + dayCounter);
// Check for game over conditions
var criticalStats = 0;
for (var key in stats) {
if (stats[key] <= 0) {
criticalStats++;
}
}
if (criticalStats >= 2) {
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();
loadScenario(); ===================================================================
--- original.js
+++ change.js
@@ -13,25 +13,25 @@
anchorY: 0.5
});
var optionText = new Text2('', {
size: 28,
- fill: 0xFFFFFF
+ fill: 0xFFFFFF,
+ wordWrap: true,
+ wordWrapWidth: 720
});
optionText.anchor.set(0.5, 0.5);
optionText.x = 0;
optionText.y = -50;
- optionText.style.wordWrap = true;
- optionText.style.wordWrapWidth = 720;
self.addChild(optionText);
var effectsText = new Text2('', {
size: 22,
- fill: 0xAAAAAA
+ fill: 0xAAAAAA,
+ wordWrap: true,
+ wordWrapWidth: 720
});
effectsText.anchor.set(0.5, 0.5);
effectsText.x = 0;
effectsText.y = 80;
- effectsText.style.wordWrap = true;
- effectsText.style.wordWrapWidth = 720;
self.addChild(effectsText);
self.setOption = function (option) {
optionText.setText(option.text);
var effectsStr = '';
@@ -59,15 +59,15 @@
titleText.y = -550;
self.addChild(titleText);
var descriptionText = new Text2('', {
size: 32,
- fill: 0xCCCCCC
+ fill: 0xCCCCCC,
+ wordWrap: true,
+ wordWrapWidth: 1600
});
descriptionText.anchor.set(0.5, 0);
descriptionText.x = 0;
descriptionText.y = -450;
- descriptionText.style.wordWrap = true;
- descriptionText.style.wordWrapWidth = 1600;
self.addChild(descriptionText);
var leftOption = self.addChild(new OptionCard());
leftOption.x = -400;
leftOption.y = 200;