/**** * Classes ****/ // AnswerBox class to display the answer var AnswerBox = Container.expand(function () { var self = Container.call(this); var boxGraphics = self.attachAsset('cardFace', { anchorX: 0.5, anchorY: 0.5, width: 800, height: 1400 }); self.boxGraphics = boxGraphics; self.text = new Text2('', { size: 65, fill: "#000000", font: "Garamond", wordWrap: true, wordWrapWidth: 400 // Set maxWidth to 400 }); self.text.x = (boxGraphics.width - self.text.width) / 2; self.text.y = (boxGraphics.height - self.text.height) / 2; self.addChild(self.text); self.setChildIndex(self.text, self.children.length - 1); self.update = function () { // Any per-frame updates for the answer box }; }); // AskButton class to allow the player to ask a question var AskButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.attachAsset('Ask', { anchorX: 0.5, anchorY: 0.5 }); // Removed borderGraphics to eliminate black background around ask button self.addChild(buttonGraphics); self.update = function () { // Any per-frame updates for the ask button }; self.down = function () { var answers = ["It is certain that your suspicions are correct.", "Proceed with this, but beware of your own hubris.", "Success is possible, but do not underestimate the challenge.", "Beware, there is danger in rushing things.", "It is unlikely.", "Rejoice! What you wish shall come to pass.", "Do not force the issue. Allow fate to reveal itself.", "Do not wait for the right moment. Act now.", "Your query is filled with trepidation. Calm yourself and ask again...", "The answers you seek are unknowable at this time. Patience is key.", "It seems you know the answer to this question already... but fear the answer."]; var randomAnswer = answers[Math.floor(Math.random() * answers.length)]; var wrappedText = wrapText(randomAnswer, 900); // Adjust width to fit within the box with buffer answerBox.text.setText(wrappedText); answerBox.text.x = -170; // Move the text right on the screen by 50px answerBox.text.y = -245; // Set the y-coordinate to -245 to raise the text by 100px answerBox.x = 2048 / 2; // Center the box horizontally answerBox.y = 2732 / 2; // Center the box vertically LK.getSound('Ask').play(); // Play the ask sound // Set visibility to 100% answerBox.alpha = 0; fadeIn(answerBox, 1000); // Fade in over 1 second (1000ms) // answerBox is already initialized and added to the game in the global scope }; }); /**** * Initialize Game ****/ //<Assets used in the game will automatically appear here> var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ function fadeIn(element, duration) { var increment = 1 / (duration / 16.67); // Assuming 60 FPS, 16.67ms per frame var interval = LK.setInterval(function () { if (element.alpha < 1) { element.alpha += increment; } else { element.alpha = 1; LK.clearInterval(interval); } }, 16.67); // Run every frame } function wrapText(text, maxWidth) { var words = text.split(' '); var lines = []; var currentLine = words[0]; for (var i = 1; i < words.length; i++) { var word = words[i]; var testLine = new Text2(currentLine + " " + word, { size: 101, font: "Garamond", wordWrap: true, wordWrapWidth: 509 // Set maxWidth to 509 }); var width = testLine.width + 20; // Add buffer to the width calculation if (width > maxWidth) { lines.push(currentLine); currentLine = word; } else { currentLine += " " + word; } } lines.push(currentLine); return lines.join("\n"); } var wallpaper = game.attachAsset('Wallpaper', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2, scaleX: 2048 / 1500, scaleY: 2732 / 1500 }); game.addChild(wallpaper); var madamImage = game.attachAsset('Madam', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 }); game.addChild(madamImage); // Update function for game // Add the Ask button to the game var askButton = new AskButton(); askButton.x = 2048 / 2; // Center the button horizontally askButton.y = 2732 - askButton.height / 2 - 100; // Position the button at the bottom of the screen with a buffer game.addChild(askButton); // Initialize AnswerBox after AskButton var answerBox = new AnswerBox(); answerBox.x = 2048 / 2; // Center the box horizontally answerBox.y = 2732 / 2; // Center the box vertically answerBox.alpha = 0; // Set initial alpha to 0 to make the box invisible game.addChild(answerBox); // Ensure that the text is displaying in front of the answer box answerBox.setChildIndex(answerBox.text, answerBox.children.length - 1); // LK.effects.fadeIn(answerBox, 1000); // Moved to AskButton.down method game.update = function () { askButton.update(); answerBox.update(); };
/****
* Classes
****/
// AnswerBox class to display the answer
var AnswerBox = Container.expand(function () {
var self = Container.call(this);
var boxGraphics = self.attachAsset('cardFace', {
anchorX: 0.5,
anchorY: 0.5,
width: 800,
height: 1400
});
self.boxGraphics = boxGraphics;
self.text = new Text2('', {
size: 65,
fill: "#000000",
font: "Garamond",
wordWrap: true,
wordWrapWidth: 400 // Set maxWidth to 400
});
self.text.x = (boxGraphics.width - self.text.width) / 2;
self.text.y = (boxGraphics.height - self.text.height) / 2;
self.addChild(self.text);
self.setChildIndex(self.text, self.children.length - 1);
self.update = function () {
// Any per-frame updates for the answer box
};
});
// AskButton class to allow the player to ask a question
var AskButton = Container.expand(function () {
var self = Container.call(this);
var buttonGraphics = self.attachAsset('Ask', {
anchorX: 0.5,
anchorY: 0.5
});
// Removed borderGraphics to eliminate black background around ask button
self.addChild(buttonGraphics);
self.update = function () {
// Any per-frame updates for the ask button
};
self.down = function () {
var answers = ["It is certain that your suspicions are correct.", "Proceed with this, but beware of your own hubris.", "Success is possible, but do not underestimate the challenge.", "Beware, there is danger in rushing things.", "It is unlikely.", "Rejoice! What you wish shall come to pass.", "Do not force the issue. Allow fate to reveal itself.", "Do not wait for the right moment. Act now.", "Your query is filled with trepidation. Calm yourself and ask again...", "The answers you seek are unknowable at this time. Patience is key.", "It seems you know the answer to this question already... but fear the answer."];
var randomAnswer = answers[Math.floor(Math.random() * answers.length)];
var wrappedText = wrapText(randomAnswer, 900); // Adjust width to fit within the box with buffer
answerBox.text.setText(wrappedText);
answerBox.text.x = -170; // Move the text right on the screen by 50px
answerBox.text.y = -245; // Set the y-coordinate to -245 to raise the text by 100px
answerBox.x = 2048 / 2; // Center the box horizontally
answerBox.y = 2732 / 2; // Center the box vertically
LK.getSound('Ask').play(); // Play the ask sound
// Set visibility to 100%
answerBox.alpha = 0;
fadeIn(answerBox, 1000); // Fade in over 1 second (1000ms)
// answerBox is already initialized and added to the game in the global scope
};
});
/****
* Initialize Game
****/
//<Assets used in the game will automatically appear here>
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
function fadeIn(element, duration) {
var increment = 1 / (duration / 16.67); // Assuming 60 FPS, 16.67ms per frame
var interval = LK.setInterval(function () {
if (element.alpha < 1) {
element.alpha += increment;
} else {
element.alpha = 1;
LK.clearInterval(interval);
}
}, 16.67); // Run every frame
}
function wrapText(text, maxWidth) {
var words = text.split(' ');
var lines = [];
var currentLine = words[0];
for (var i = 1; i < words.length; i++) {
var word = words[i];
var testLine = new Text2(currentLine + " " + word, {
size: 101,
font: "Garamond",
wordWrap: true,
wordWrapWidth: 509 // Set maxWidth to 509
});
var width = testLine.width + 20; // Add buffer to the width calculation
if (width > maxWidth) {
lines.push(currentLine);
currentLine = word;
} else {
currentLine += " " + word;
}
}
lines.push(currentLine);
return lines.join("\n");
}
var wallpaper = game.attachAsset('Wallpaper', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2,
scaleX: 2048 / 1500,
scaleY: 2732 / 1500
});
game.addChild(wallpaper);
var madamImage = game.attachAsset('Madam', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2
});
game.addChild(madamImage);
// Update function for game
// Add the Ask button to the game
var askButton = new AskButton();
askButton.x = 2048 / 2; // Center the button horizontally
askButton.y = 2732 - askButton.height / 2 - 100; // Position the button at the bottom of the screen with a buffer
game.addChild(askButton);
// Initialize AnswerBox after AskButton
var answerBox = new AnswerBox();
answerBox.x = 2048 / 2; // Center the box horizontally
answerBox.y = 2732 / 2; // Center the box vertically
answerBox.alpha = 0; // Set initial alpha to 0 to make the box invisible
game.addChild(answerBox);
// Ensure that the text is displaying in front of the answer box
answerBox.setChildIndex(answerBox.text, answerBox.children.length - 1);
// LK.effects.fadeIn(answerBox, 1000); // Moved to AskButton.down method
game.update = function () {
askButton.update();
answerBox.update();
};
The face of a card. The card center is blank, with a antique cream background. The card is framed with an ornate design.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
The back of a card. It's a faded red color and features a beautiful gold Edwardian design. The cards look slightly old, as if used for many years.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
An ornate brass sign that says "ask". Is it rectangular. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Madam curio sits in front of you. She is an Edwardian era fortune teller. She is seen from the waist up in front of an ornate table.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. Full color pixel art.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
"ASK" sign with brass frame. Edwardian era style. Full color pixel art.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
The wallpaper of a Victorian home. Muted pattern, old and vintage, Edwardian style pixel art. Pixel art gas lamps in a dark room. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.