Hi there,
I'm not a coder so I've relied on the help of ChatGPT, but can't seem to get the image of a tarot card to show up properly. I wonder if anyone can help to see what I've done, greatly appreciate your help.
I'm not a coder so I've relied on the help of ChatGPT, but can't seem to get the image of a tarot card to show up properly. I wonder if anyone can help to see what I've done, greatly appreciate your help.
Code:
// OneCardTarot.js
(function() {
var OneCardTarot = {};
// Define card data
OneCardTarot.cards = [
{ name: "The Fool", imageName: "TheFool", description: "A new beginning, innocence, spontaneity." },
{ name: "The Magician", imageName: "TheMagician", description: "Manifestation, resourcefulness, power." },
// ... Define more card data ...
];
// Register plugin command
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);
if (command === 'OneCardTarot') {
this.startOneCardReading();
}
};
// Tarot reading logic
Game_Interpreter.prototype.startOneCardReading = function() {
var selectedCardIndex = Math.floor(Math.random() * OneCardTarot.cards.length);
var selectedCard = OneCardTarot.cards[selectedCardIndex];
// Display the card image using a picture event
var imageName = selectedCard.imageName;
var pictureId = 1; //
var x = Graphics.boxWidth / 2;
var y = Graphics.boxHeight / 2;
$gameScreen.showPicture(pictureId, imageName, 0, x, y, 100, 100, 255, 0);
$gameMessage.add(selectedCard.name + ": " + selectedCard.description);
// Remove the picture event after a short delay
setTimeout(function() {
$gameScreen.erasePicture(pictureId);
}, 3000); // Remove after 3 seconds (adjust as needed)
};
window.OneCardTarot = OneCardTarot;
})();