User prompt
There should be a main menu in the game with Turkish and English language options, as well as a "Start" button. The game should continue in the selected language.
Code edit (1 edits merged)
Please save this source code
User prompt
King's Dilemma: Swipe for the Throne
Initial prompt
The player is in the role of the king and makes choices by swiping the cards (decision options) to the right or left. These choices affect the four main balances (religion, people, army, economy). The goal is to stay on the throne as long as possible while maintaining the balance. The idea is simple but the game is very deep as it loads.
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// Card class: represents a decision card
var Card = Container.expand(function () {
var self = Container.call(this);
// Card shadow for depth
var shadow = self.attachAsset('cardShadow', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 20,
alpha: 0.15
});
// Card background
var bg = self.attachAsset('card', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 0
});
// Card text
var text = new Text2('', {
size: 70,
fill: 0x222222,
wordWrap: true,
wordWrapWidth: 800,
align: 'center'
});
text.anchor.set(0.5, 0.5);
text.x = 0;
text.y = -200;
self.addChild(text);
// Left choice text
var leftText = new Text2('', {
size: 55,
fill: 0x6A6A6A,
wordWrap: true,
wordWrapWidth: 350,
align: 'left'
});
leftText.anchor.set(0, 0.5);
leftText.x = -400;
leftText.y = 400;
self.addChild(leftText);
// Right choice text
var rightText = new Text2('', {
size: 55,
fill: 0x6A6A6A,
wordWrap: true,
wordWrapWidth: 350,
align: 'right'
});
rightText.anchor.set(1, 0.5);
rightText.x = 400;
rightText.y = 400;
self.addChild(rightText);
// Card data
self.cardData = null;
// Set card content
self.setCard = function (cardData) {
self.cardData = cardData;
text.setText(cardData.text);
leftText.setText(cardData.left.text);
rightText.setText(cardData.right.text);
};
// Animate card back to center
self.animateToCenter = function (onFinish) {
tween(self, {
x: 0,
y: 0,
rotation: 0
}, {
duration: 250,
easing: tween.easeOut,
onFinish: onFinish
});
};
// Animate card off screen (left or right)
self.animateOff = function (direction, onFinish) {
var targetX = direction === 'left' ? -1200 : 1200;
tween(self, {
x: targetX,
y: self.y + 200 * (direction === 'left' ? 1 : -1),
rotation: direction === 'left' ? -0.5 : 0.5
}, {
duration: 300,
easing: tween.cubicOut,
onFinish: onFinish
});
};
return self;
});
// StatBar class: shows a single stat (religion, people, army, economy)
var StatBar = Container.expand(function () {
var self = Container.call(this);
// Background
var bg = self.attachAsset('statBarBg', {
anchorX: 0,
anchorY: 0.5,
x: 0,
y: 0
});
// Fill (color depends on stat)
self.fill = null;
self.setType = function (type) {
var fillId = 'statBarFill_' + type;
self.fill = self.attachAsset(fillId, {
anchorX: 0,
anchorY: 0.5,
x: 0,
y: 0
});
self.addChildAt(self.fill, 1);
};
// Label
self.label = new Text2('', {
size: 45,
fill: 0xFFFFFF
});
self.label.anchor.set(1, 0.5);
self.label.x = -20;
self.label.y = 0;
self.addChild(self.label);
// Set value (0-100)
self.setValue = function (val) {
if (val < 0) val = 0;
if (val > 100) val = 100;
self.fill.width = 4 * val; // 400px max
};
// Set label
self.setLabel = function (txt) {
self.label.setText(txt);
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1a1a1a
});
/****
* Game Code
****/
// Stat bar backgrounds and fills
// Card background shapes
// --- Game Data ---
// List of cards (minimal set for MVP, can be expanded)
var cards = [{
text: "A neighboring kingdom requests a marriage alliance.",
left: {
text: "Accept the alliance.",
effects: {
religion: +5,
people: +10,
army: -5,
economy: +10
}
},
right: {
text: "Refuse the offer.",
effects: {
religion: -5,
people: -10,
army: +5,
economy: -10
}
}
}, {
text: "The church demands more gold for a new cathedral.",
left: {
text: "Fund the cathedral.",
effects: {
religion: +15,
people: -5,
army: 0,
economy: -20
}
},
right: {
text: "Refuse the request.",
effects: {
religion: -15,
people: +5,
army: 0,
economy: +10
}
}
}, {
text: "The army wants to recruit more soldiers.",
left: {
text: "Approve recruitment.",
effects: {
religion: 0,
people: -10,
army: +20,
economy: -15
}
},
right: {
text: "Deny the request.",
effects: {
religion: 0,
people: +5,
army: -15,
economy: +5
}
}
}, {
text: "A famine strikes the land.",
left: {
text: "Open the royal granaries.",
effects: {
religion: 0,
people: +20,
army: 0,
economy: -20
}
},
right: {
text: "Do nothing.",
effects: {
religion: 0,
people: -20,
army: 0,
economy: 0
}
}
}, {
text: "Merchants offer a lucrative trade deal.",
left: {
text: "Accept the deal.",
effects: {
religion: 0,
people: +5,
army: 0,
economy: +20
}
},
right: {
text: "Decline the offer.",
effects: {
religion: 0,
people: -5,
army: 0,
economy: -10
}
}
}, {
text: "A heretic is spreading dissent.",
left: {
text: "Punish the heretic.",
effects: {
religion: +10,
people: -10,
army: 0,
economy: 0
}
},
right: {
text: "Show mercy.",
effects: {
religion: -10,
people: +10,
army: 0,
economy: 0
}
}
}, {
text: "The army requests better equipment.",
left: {
text: "Invest in equipment.",
effects: {
religion: 0,
people: 0,
army: +15,
economy: -15
}
},
right: {
text: "Refuse.",
effects: {
religion: 0,
people: 0,
army: -10,
economy: +5
}
}
}, {
text: "A festival is proposed to boost morale.",
left: {
text: "Host the festival.",
effects: {
religion: +5,
people: +15,
army: 0,
economy: -10
}
},
right: {
text: "Decline.",
effects: {
religion: -5,
people: -10,
army: 0,
economy: +5
}
}
}];
// Shuffle cards for each game
function shuffleCards(arr) {
var a = arr.slice();
for (var i = a.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var t = a[i];
a[i] = a[j];
a[j] = t;
}
return a;
}
// --- Game State ---
var statNames = ['religion', 'people', 'army', 'economy'];
var statLabels = {
religion: 'Religion',
people: 'People',
army: 'Army',
economy: 'Economy'
};
var statColors = {
religion: 0x6a4cff,
people: 0x2ecc40,
army: 0xff4136,
economy: 0xffdc00
};
var stats = {
religion: 50,
people: 50,
army: 50,
economy: 50
};
var statBars = {};
var currentCard = null;
var cardIndex = 0;
var deck = [];
var isDragging = false;
var dragStart = {
x: 0,
y: 0
};
var dragOffset = {
x: 0,
y: 0
};
var dragThreshold = 200; // px to trigger a choice
var cardContainer = null;
var reign = 0; // Number of cards survived
// --- UI Setup ---
// Stat bars at top (avoid top left 100x100)
var statBarY = 120;
var statBarSpacing = 440;
for (var i = 0; i < statNames.length; i++) {
var stat = statNames[i];
var bar = new StatBar();
bar.setType(stat);
bar.setLabel(statLabels[stat]);
bar.x = 120 + i * statBarSpacing;
bar.y = statBarY;
bar.setValue(stats[stat]);
statBars[stat] = bar;
game.addChild(bar);
}
// Reign counter (center top, below stat bars)
var reignText = new Text2('Reign: 0', {
size: 70,
fill: 0xFFFFFF
});
reignText.anchor.set(0.5, 0);
reignText.x = 2048 / 2;
reignText.y = 220;
LK.gui.top.addChild(reignText);
// Card container (centered)
cardContainer = new Container();
cardContainer.x = 2048 / 2;
cardContainer.y = 2732 / 2 + 100;
game.addChild(cardContainer);
// --- Game Logic ---
function startGame() {
// Reset stats
stats.religion = 50;
stats.people = 50;
stats.army = 50;
stats.economy = 50;
reign = 0;
cardIndex = 0;
deck = shuffleCards(cards);
updateStatBars();
reignText.setText('Reign: 0');
clearCard();
showNextCard();
}
function updateStatBars() {
for (var i = 0; i < statNames.length; i++) {
var stat = statNames[i];
statBars[stat].setValue(stats[stat]);
}
}
function clearCard() {
if (currentCard) {
currentCard.destroy();
currentCard = null;
}
}
function showNextCard() {
clearCard();
if (cardIndex >= deck.length) {
// Reshuffle and continue
deck = shuffleCards(cards);
cardIndex = 0;
}
var cardData = deck[cardIndex];
var card = new Card();
card.setCard(cardData);
card.x = 0;
card.y = 0;
card.rotation = 0;
cardContainer.addChild(card);
currentCard = card;
isDragging = false;
dragStart.x = 0;
dragStart.y = 0;
dragOffset.x = 0;
dragOffset.y = 0;
}
// Apply effects and check for game over
function applyChoice(effects) {
for (var i = 0; i < statNames.length; i++) {
var stat = statNames[i];
stats[stat] += effects[stat] || 0;
if (stats[stat] > 100) stats[stat] = 100;
if (stats[stat] < 0) stats[stat] = 0;
}
updateStatBars();
reign++;
reignText.setText('Reign: ' + reign);
// Check for loss (any stat at 0 or 100)
var fail = false;
for (var i = 0; i < statNames.length; i++) {
var stat = statNames[i];
if (stats[stat] <= 0 || stats[stat] >= 100) {
fail = stat;
break;
}
}
if (fail) {
// Flash screen with stat color
LK.effects.flashScreen(statColors[fail], 1000);
LK.showGameOver();
return;
}
// Next card
cardIndex++;
showNextCard();
}
// --- Card Dragging and Swiping ---
function handleCardMove(x, y, obj) {
if (!currentCard) return;
if (!isDragging) return;
// Convert to local cardContainer coordinates
var local = cardContainer.toLocal({
x: x,
y: y
});
var dx = local.x - dragStart.x;
var dy = local.y - dragStart.y;
dragOffset.x = dx;
dragOffset.y = dy;
// Move card with finger
currentCard.x = dx;
currentCard.y = dy;
currentCard.rotation = dx / 1200; // slight tilt
// Optionally, highlight left/right text as user drags
var leftAlpha = Math.max(0.5, 1 - Math.max(0, dx) / 300);
var rightAlpha = Math.max(0.5, 1 + Math.min(0, dx) / 300);
currentCard.children[2].alpha = leftAlpha; // leftText
currentCard.children[3].alpha = rightAlpha; // rightText
}
function handleCardUp(x, y, obj) {
if (!currentCard) return;
if (!isDragging) return;
isDragging = false;
var dx = dragOffset.x;
var direction = null;
if (dx < -dragThreshold) direction = 'left';
if (dx > dragThreshold) direction = 'right';
if (direction) {
// Animate card off screen, then apply choice
currentCard.animateOff(direction, function () {
var effects = direction === 'left' ? currentCard.cardData.left.effects : currentCard.cardData.right.effects;
applyChoice(effects);
});
} else {
// Animate card back to center
currentCard.animateToCenter(function () {
// Reset alphas
if (currentCard) {
currentCard.children[2].alpha = 1;
currentCard.children[3].alpha = 1;
}
});
}
}
function handleCardDown(x, y, obj) {
if (!currentCard) return;
// Only start drag if touch is on card
var local = cardContainer.toLocal({
x: x,
y: y
});
var cardBounds = {
x: currentCard.x - 450,
y: currentCard.y - 600,
width: 900,
height: 1200
};
if (local.x >= cardBounds.x && local.x <= cardBounds.x + cardBounds.width && local.y >= cardBounds.y && local.y <= cardBounds.y + cardBounds.height) {
isDragging = true;
dragStart.x = local.x - currentCard.x;
dragStart.y = local.y - currentCard.y;
dragOffset.x = 0;
dragOffset.y = 0;
}
}
// --- Game Event Handlers ---
game.move = function (x, y, obj) {
handleCardMove(x, y, obj);
};
game.down = function (x, y, obj) {
handleCardDown(x, y, obj);
};
game.up = function (x, y, obj) {
handleCardUp(x, y, obj);
};
// On game over, restart game after popup
LK.on('gameover', function () {
// Wait for LK to reset, then start new game
LK.setTimeout(function () {
startGame();
}, 100);
});
// On you win (not used in MVP, but for future expansion)
LK.on('youwin', function () {
LK.setTimeout(function () {
startGame();
}, 100);
});
// --- Start the game ---
startGame(); ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,565 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+// Card class: represents a decision card
+var Card = Container.expand(function () {
+ var self = Container.call(this);
+ // Card shadow for depth
+ var shadow = self.attachAsset('cardShadow', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 0,
+ y: 20,
+ alpha: 0.15
+ });
+ // Card background
+ var bg = self.attachAsset('card', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 0,
+ y: 0
+ });
+ // Card text
+ var text = new Text2('', {
+ size: 70,
+ fill: 0x222222,
+ wordWrap: true,
+ wordWrapWidth: 800,
+ align: 'center'
+ });
+ text.anchor.set(0.5, 0.5);
+ text.x = 0;
+ text.y = -200;
+ self.addChild(text);
+ // Left choice text
+ var leftText = new Text2('', {
+ size: 55,
+ fill: 0x6A6A6A,
+ wordWrap: true,
+ wordWrapWidth: 350,
+ align: 'left'
+ });
+ leftText.anchor.set(0, 0.5);
+ leftText.x = -400;
+ leftText.y = 400;
+ self.addChild(leftText);
+ // Right choice text
+ var rightText = new Text2('', {
+ size: 55,
+ fill: 0x6A6A6A,
+ wordWrap: true,
+ wordWrapWidth: 350,
+ align: 'right'
+ });
+ rightText.anchor.set(1, 0.5);
+ rightText.x = 400;
+ rightText.y = 400;
+ self.addChild(rightText);
+ // Card data
+ self.cardData = null;
+ // Set card content
+ self.setCard = function (cardData) {
+ self.cardData = cardData;
+ text.setText(cardData.text);
+ leftText.setText(cardData.left.text);
+ rightText.setText(cardData.right.text);
+ };
+ // Animate card back to center
+ self.animateToCenter = function (onFinish) {
+ tween(self, {
+ x: 0,
+ y: 0,
+ rotation: 0
+ }, {
+ duration: 250,
+ easing: tween.easeOut,
+ onFinish: onFinish
+ });
+ };
+ // Animate card off screen (left or right)
+ self.animateOff = function (direction, onFinish) {
+ var targetX = direction === 'left' ? -1200 : 1200;
+ tween(self, {
+ x: targetX,
+ y: self.y + 200 * (direction === 'left' ? 1 : -1),
+ rotation: direction === 'left' ? -0.5 : 0.5
+ }, {
+ duration: 300,
+ easing: tween.cubicOut,
+ onFinish: onFinish
+ });
+ };
+ return self;
+});
+// StatBar class: shows a single stat (religion, people, army, economy)
+var StatBar = Container.expand(function () {
+ var self = Container.call(this);
+ // Background
+ var bg = self.attachAsset('statBarBg', {
+ anchorX: 0,
+ anchorY: 0.5,
+ x: 0,
+ y: 0
+ });
+ // Fill (color depends on stat)
+ self.fill = null;
+ self.setType = function (type) {
+ var fillId = 'statBarFill_' + type;
+ self.fill = self.attachAsset(fillId, {
+ anchorX: 0,
+ anchorY: 0.5,
+ x: 0,
+ y: 0
+ });
+ self.addChildAt(self.fill, 1);
+ };
+ // Label
+ self.label = new Text2('', {
+ size: 45,
+ fill: 0xFFFFFF
+ });
+ self.label.anchor.set(1, 0.5);
+ self.label.x = -20;
+ self.label.y = 0;
+ self.addChild(self.label);
+ // Set value (0-100)
+ self.setValue = function (val) {
+ if (val < 0) val = 0;
+ if (val > 100) val = 100;
+ self.fill.width = 4 * val; // 400px max
+ };
+ // Set label
+ self.setLabel = function (txt) {
+ self.label.setText(txt);
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x1a1a1a
+});
+
+/****
+* Game Code
+****/
+// Stat bar backgrounds and fills
+// Card background shapes
+// --- Game Data ---
+// List of cards (minimal set for MVP, can be expanded)
+var cards = [{
+ text: "A neighboring kingdom requests a marriage alliance.",
+ left: {
+ text: "Accept the alliance.",
+ effects: {
+ religion: +5,
+ people: +10,
+ army: -5,
+ economy: +10
+ }
+ },
+ right: {
+ text: "Refuse the offer.",
+ effects: {
+ religion: -5,
+ people: -10,
+ army: +5,
+ economy: -10
+ }
+ }
+}, {
+ text: "The church demands more gold for a new cathedral.",
+ left: {
+ text: "Fund the cathedral.",
+ effects: {
+ religion: +15,
+ people: -5,
+ army: 0,
+ economy: -20
+ }
+ },
+ right: {
+ text: "Refuse the request.",
+ effects: {
+ religion: -15,
+ people: +5,
+ army: 0,
+ economy: +10
+ }
+ }
+}, {
+ text: "The army wants to recruit more soldiers.",
+ left: {
+ text: "Approve recruitment.",
+ effects: {
+ religion: 0,
+ people: -10,
+ army: +20,
+ economy: -15
+ }
+ },
+ right: {
+ text: "Deny the request.",
+ effects: {
+ religion: 0,
+ people: +5,
+ army: -15,
+ economy: +5
+ }
+ }
+}, {
+ text: "A famine strikes the land.",
+ left: {
+ text: "Open the royal granaries.",
+ effects: {
+ religion: 0,
+ people: +20,
+ army: 0,
+ economy: -20
+ }
+ },
+ right: {
+ text: "Do nothing.",
+ effects: {
+ religion: 0,
+ people: -20,
+ army: 0,
+ economy: 0
+ }
+ }
+}, {
+ text: "Merchants offer a lucrative trade deal.",
+ left: {
+ text: "Accept the deal.",
+ effects: {
+ religion: 0,
+ people: +5,
+ army: 0,
+ economy: +20
+ }
+ },
+ right: {
+ text: "Decline the offer.",
+ effects: {
+ religion: 0,
+ people: -5,
+ army: 0,
+ economy: -10
+ }
+ }
+}, {
+ text: "A heretic is spreading dissent.",
+ left: {
+ text: "Punish the heretic.",
+ effects: {
+ religion: +10,
+ people: -10,
+ army: 0,
+ economy: 0
+ }
+ },
+ right: {
+ text: "Show mercy.",
+ effects: {
+ religion: -10,
+ people: +10,
+ army: 0,
+ economy: 0
+ }
+ }
+}, {
+ text: "The army requests better equipment.",
+ left: {
+ text: "Invest in equipment.",
+ effects: {
+ religion: 0,
+ people: 0,
+ army: +15,
+ economy: -15
+ }
+ },
+ right: {
+ text: "Refuse.",
+ effects: {
+ religion: 0,
+ people: 0,
+ army: -10,
+ economy: +5
+ }
+ }
+}, {
+ text: "A festival is proposed to boost morale.",
+ left: {
+ text: "Host the festival.",
+ effects: {
+ religion: +5,
+ people: +15,
+ army: 0,
+ economy: -10
+ }
+ },
+ right: {
+ text: "Decline.",
+ effects: {
+ religion: -5,
+ people: -10,
+ army: 0,
+ economy: +5
+ }
+ }
+}];
+// Shuffle cards for each game
+function shuffleCards(arr) {
+ var a = arr.slice();
+ for (var i = a.length - 1; i > 0; i--) {
+ var j = Math.floor(Math.random() * (i + 1));
+ var t = a[i];
+ a[i] = a[j];
+ a[j] = t;
+ }
+ return a;
+}
+// --- Game State ---
+var statNames = ['religion', 'people', 'army', 'economy'];
+var statLabels = {
+ religion: 'Religion',
+ people: 'People',
+ army: 'Army',
+ economy: 'Economy'
+};
+var statColors = {
+ religion: 0x6a4cff,
+ people: 0x2ecc40,
+ army: 0xff4136,
+ economy: 0xffdc00
+};
+var stats = {
+ religion: 50,
+ people: 50,
+ army: 50,
+ economy: 50
+};
+var statBars = {};
+var currentCard = null;
+var cardIndex = 0;
+var deck = [];
+var isDragging = false;
+var dragStart = {
+ x: 0,
+ y: 0
+};
+var dragOffset = {
+ x: 0,
+ y: 0
+};
+var dragThreshold = 200; // px to trigger a choice
+var cardContainer = null;
+var reign = 0; // Number of cards survived
+// --- UI Setup ---
+// Stat bars at top (avoid top left 100x100)
+var statBarY = 120;
+var statBarSpacing = 440;
+for (var i = 0; i < statNames.length; i++) {
+ var stat = statNames[i];
+ var bar = new StatBar();
+ bar.setType(stat);
+ bar.setLabel(statLabels[stat]);
+ bar.x = 120 + i * statBarSpacing;
+ bar.y = statBarY;
+ bar.setValue(stats[stat]);
+ statBars[stat] = bar;
+ game.addChild(bar);
+}
+// Reign counter (center top, below stat bars)
+var reignText = new Text2('Reign: 0', {
+ size: 70,
+ fill: 0xFFFFFF
+});
+reignText.anchor.set(0.5, 0);
+reignText.x = 2048 / 2;
+reignText.y = 220;
+LK.gui.top.addChild(reignText);
+// Card container (centered)
+cardContainer = new Container();
+cardContainer.x = 2048 / 2;
+cardContainer.y = 2732 / 2 + 100;
+game.addChild(cardContainer);
+// --- Game Logic ---
+function startGame() {
+ // Reset stats
+ stats.religion = 50;
+ stats.people = 50;
+ stats.army = 50;
+ stats.economy = 50;
+ reign = 0;
+ cardIndex = 0;
+ deck = shuffleCards(cards);
+ updateStatBars();
+ reignText.setText('Reign: 0');
+ clearCard();
+ showNextCard();
+}
+function updateStatBars() {
+ for (var i = 0; i < statNames.length; i++) {
+ var stat = statNames[i];
+ statBars[stat].setValue(stats[stat]);
+ }
+}
+function clearCard() {
+ if (currentCard) {
+ currentCard.destroy();
+ currentCard = null;
+ }
+}
+function showNextCard() {
+ clearCard();
+ if (cardIndex >= deck.length) {
+ // Reshuffle and continue
+ deck = shuffleCards(cards);
+ cardIndex = 0;
+ }
+ var cardData = deck[cardIndex];
+ var card = new Card();
+ card.setCard(cardData);
+ card.x = 0;
+ card.y = 0;
+ card.rotation = 0;
+ cardContainer.addChild(card);
+ currentCard = card;
+ isDragging = false;
+ dragStart.x = 0;
+ dragStart.y = 0;
+ dragOffset.x = 0;
+ dragOffset.y = 0;
+}
+// Apply effects and check for game over
+function applyChoice(effects) {
+ for (var i = 0; i < statNames.length; i++) {
+ var stat = statNames[i];
+ stats[stat] += effects[stat] || 0;
+ if (stats[stat] > 100) stats[stat] = 100;
+ if (stats[stat] < 0) stats[stat] = 0;
+ }
+ updateStatBars();
+ reign++;
+ reignText.setText('Reign: ' + reign);
+ // Check for loss (any stat at 0 or 100)
+ var fail = false;
+ for (var i = 0; i < statNames.length; i++) {
+ var stat = statNames[i];
+ if (stats[stat] <= 0 || stats[stat] >= 100) {
+ fail = stat;
+ break;
+ }
+ }
+ if (fail) {
+ // Flash screen with stat color
+ LK.effects.flashScreen(statColors[fail], 1000);
+ LK.showGameOver();
+ return;
+ }
+ // Next card
+ cardIndex++;
+ showNextCard();
+}
+// --- Card Dragging and Swiping ---
+function handleCardMove(x, y, obj) {
+ if (!currentCard) return;
+ if (!isDragging) return;
+ // Convert to local cardContainer coordinates
+ var local = cardContainer.toLocal({
+ x: x,
+ y: y
+ });
+ var dx = local.x - dragStart.x;
+ var dy = local.y - dragStart.y;
+ dragOffset.x = dx;
+ dragOffset.y = dy;
+ // Move card with finger
+ currentCard.x = dx;
+ currentCard.y = dy;
+ currentCard.rotation = dx / 1200; // slight tilt
+ // Optionally, highlight left/right text as user drags
+ var leftAlpha = Math.max(0.5, 1 - Math.max(0, dx) / 300);
+ var rightAlpha = Math.max(0.5, 1 + Math.min(0, dx) / 300);
+ currentCard.children[2].alpha = leftAlpha; // leftText
+ currentCard.children[3].alpha = rightAlpha; // rightText
+}
+function handleCardUp(x, y, obj) {
+ if (!currentCard) return;
+ if (!isDragging) return;
+ isDragging = false;
+ var dx = dragOffset.x;
+ var direction = null;
+ if (dx < -dragThreshold) direction = 'left';
+ if (dx > dragThreshold) direction = 'right';
+ if (direction) {
+ // Animate card off screen, then apply choice
+ currentCard.animateOff(direction, function () {
+ var effects = direction === 'left' ? currentCard.cardData.left.effects : currentCard.cardData.right.effects;
+ applyChoice(effects);
+ });
+ } else {
+ // Animate card back to center
+ currentCard.animateToCenter(function () {
+ // Reset alphas
+ if (currentCard) {
+ currentCard.children[2].alpha = 1;
+ currentCard.children[3].alpha = 1;
+ }
+ });
+ }
+}
+function handleCardDown(x, y, obj) {
+ if (!currentCard) return;
+ // Only start drag if touch is on card
+ var local = cardContainer.toLocal({
+ x: x,
+ y: y
+ });
+ var cardBounds = {
+ x: currentCard.x - 450,
+ y: currentCard.y - 600,
+ width: 900,
+ height: 1200
+ };
+ if (local.x >= cardBounds.x && local.x <= cardBounds.x + cardBounds.width && local.y >= cardBounds.y && local.y <= cardBounds.y + cardBounds.height) {
+ isDragging = true;
+ dragStart.x = local.x - currentCard.x;
+ dragStart.y = local.y - currentCard.y;
+ dragOffset.x = 0;
+ dragOffset.y = 0;
+ }
+}
+// --- Game Event Handlers ---
+game.move = function (x, y, obj) {
+ handleCardMove(x, y, obj);
+};
+game.down = function (x, y, obj) {
+ handleCardDown(x, y, obj);
+};
+game.up = function (x, y, obj) {
+ handleCardUp(x, y, obj);
+};
+// On game over, restart game after popup
+LK.on('gameover', function () {
+ // Wait for LK to reset, then start new game
+ LK.setTimeout(function () {
+ startGame();
+ }, 100);
+});
+// On you win (not used in MVP, but for future expansion)
+LK.on('youwin', function () {
+ LK.setTimeout(function () {
+ startGame();
+ }, 100);
+});
+// --- Start the game ---
+startGame();
\ No newline at end of file
bir din adamı simgesi beyaz olsun içi oyuncun kararına göre dolub boşalacak her hangi bir terinde hiç bir dinle alakalı din simvolu bulunmasın. In-Game asset. 2d. High contrast. No shadows
2 çapraz bir birne girmiş kılıç simgesi olacak beyaz olsun. In-Game asset. 2d. High contrast. No shadows
3 tane insan profil resmi 1 tane önde 2 arkada kalıyor beyaz olsun. In-Game asset. 2d. High contrast. No shadows
sadece beyaz rengte olan basit dolar simgesi. In-Game asset. 2d. High contrast. No shadows
Gerçek hayata yakın bir menü arka planı istiyorum. Yeşil doğa, çimenlikler ve taş yollar olsun. Uzakta bir kale ya da yapı görünsün. Gökyüzü mavi ve açık olsun, hava gündüz gibi. Renkler doğal tonlarda olsun, altın veya süslü detaylar olmasın. Arka plan sade ve huzurlu bir ortam sunsun, ortası menü için boş ve hafif koyu olabilir.. In-Game asset. 2d. High contrast. No shadows
Krallık oyunu başladıktan sonra kullanılacak, arka planda bir kale olan ama çok karanlık veya kasvetli görünmeyen, hafif sisli ve tarihi atmosferli bir sahne. Gökyüzü açık ya da hafif bulutlu, renkler doğal ve dengeli olmalı.”
dikdörtgen olsun içi notsarjik rengde olsun buton olarak kullanılacak genişliği uzun hiç bir yazı içermesin. In-Game asset. 2d. High contrast. No shadows
sade 1 tane kraliyet kalesi 2 tane gözcü yeri olsun beyaz renkte olsun. In-Game asset. 2d. High contrast. No shadows