User prompt
pero e dicho QUE NO SEA DE PREGUNTAS JOE
User prompt
PERO QUE NO SEA UNA TRIVIA QUE SE PARA VER PELICULAS
User prompt
QUE NO SEAN PREGUNTAS QUE TENGAS QUE VR PELICULAS
Code edit (1 edits merged)
Please save this source code
User prompt
Movie Night Trivia
Initial prompt
un juego de ver peliculas
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var AnswerButton = Container.expand(function (answerText, isCorrect) {
var self = Container.call(this);
self.isCorrect = isCorrect;
self.answered = false;
var buttonBg = self.attachAsset('answerButton', {
anchorX: 0.5,
anchorY: 0.5
});
var buttonText = new Text2(answerText, {
size: 45,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.setCorrect = function () {
self.removeChild(buttonBg);
buttonBg = self.attachAsset('answerButtonCorrect', {
anchorX: 0.5,
anchorY: 0.5
});
self.addChildAt(buttonBg, 0);
};
self.setWrong = function () {
self.removeChild(buttonBg);
buttonBg = self.attachAsset('answerButtonWrong', {
anchorX: 0.5,
anchorY: 0.5
});
self.addChildAt(buttonBg, 0);
};
self.down = function (x, y, obj) {
if (self.answered || gameEnded) return;
self.answered = true;
answerQuestion(self.isCorrect);
};
return self;
});
var QuestionDisplay = Container.expand(function () {
var self = Container.call(this);
var containerBg = self.attachAsset('questionContainer', {
anchorX: 0.5,
anchorY: 0.5
});
self.questionText = new Text2('', {
size: 50,
fill: 0xFFFFFF
});
self.questionText.anchor.set(0.5, 0.5);
self.addChild(self.questionText);
self.setQuestion = function (questionStr) {
self.questionText.setText(questionStr);
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1a1a1a
});
/****
* Game Code
****/
// Game variables
var currentQuestion = 0;
var totalQuestions = 10;
var timePerQuestion = 15;
var timeRemaining = timePerQuestion;
var gameEnded = false;
var questionStartTime = 0;
var streak = 0;
var maxStreak = 0;
// Movie trivia questions data - General knowledge that doesn't require watching movies
var movieQuestions = [{
question: "What year was the first Star Wars movie released?",
answers: ["1975", "1977", "1979", "1981"],
correct: 1
}, {
question: "Which movie studio is famous for the lion logo?",
answers: ["Warner Bros", "MGM", "Paramount", "Universal"],
correct: 1
}, {
question: "What does 'CGI' stand for in movies?",
answers: ["Computer Generated Images", "Cinema Graphics Interface", "Creative Graphics Integration", "Computer Gaming Interface"],
correct: 0
}, {
question: "Which city is known as the center of the American film industry?",
answers: ["New York", "Los Angeles", "Chicago", "Miami"],
correct: 1
}, {
question: "What is the highest-grossing movie of all time (as of 2023)?",
answers: ["Titanic", "Avatar", "Avengers: Endgame", "Star Wars"],
correct: 1
}, {
question: "Which award ceremony honors achievements in cinema?",
answers: ["Grammy Awards", "Emmy Awards", "Academy Awards", "Tony Awards"],
correct: 2
}, {
question: "What does 'PG-13' mean in movie ratings?",
answers: ["Pretty Good 13+", "Parental Guidance 13+", "Prohibited Gambling 13+", "Professional Grade 13+"],
correct: 1
}, {
question: "Which streaming service is owned by Disney?",
answers: ["Netflix", "Hulu", "Disney+", "Amazon Prime"],
correct: 2
}, {
question: "What is the name of the famous film festival in France?",
answers: ["Cannes", "Berlin", "Venice", "Toronto"],
correct: 0
}, {
question: "How many Lord of the Rings movies are in the original trilogy?",
answers: ["2", "3", "4", "5"],
correct: 1
}];
// UI Elements
var questionDisplay = game.addChild(new QuestionDisplay());
questionDisplay.x = 1024;
questionDisplay.y = 600;
var answerButtons = [];
var timerBarBg = game.addChild(LK.getAsset('timerBarBg', {
anchorX: 0.5,
anchorY: 0.5
}));
timerBarBg.x = 1024;
timerBarBg.y = 200;
var timerBar = game.addChild(LK.getAsset('timerBar', {
anchorX: 0,
anchorY: 0.5
}));
timerBar.x = 124;
timerBar.y = 200;
// Score display
var scoreText = new Text2('Score: 0', {
size: 80,
fill: 0xFFFFFF
});
scoreText.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreText);
var questionCountText = new Text2('Question 1 of 10', {
size: 60,
fill: 0xFFFFFF
});
questionCountText.anchor.set(0.5, 0);
questionCountText.y = 100;
LK.gui.top.addChild(questionCountText);
var streakText = new Text2('Streak: 0', {
size: 50,
fill: 0xF39C12
});
streakText.anchor.set(1, 0);
streakText.y = 200;
LK.gui.topRight.addChild(streakText);
// Game functions
function setupAnswerButtons() {
// Clear existing buttons
for (var i = 0; i < answerButtons.length; i++) {
answerButtons[i].destroy();
}
answerButtons = [];
var question = movieQuestions[currentQuestion];
var buttonPositions = [{
x: 512,
y: 1200
}, {
x: 1536,
y: 1200
}, {
x: 512,
y: 1350
}, {
x: 1536,
y: 1350
}];
for (var i = 0; i < question.answers.length; i++) {
var button = new AnswerButton(question.answers[i], i === question.correct);
button.x = buttonPositions[i].x;
button.y = buttonPositions[i].y;
answerButtons.push(button);
game.addChild(button);
}
}
function startQuestion() {
if (currentQuestion >= totalQuestions) {
endGame();
return;
}
timeRemaining = timePerQuestion;
questionStartTime = LK.ticks;
var question = movieQuestions[currentQuestion];
questionDisplay.setQuestion(question.question);
setupAnswerButtons();
questionCountText.setText('Question ' + (currentQuestion + 1) + ' of ' + totalQuestions);
}
function answerQuestion(isCorrect) {
for (var i = 0; i < answerButtons.length; i++) {
answerButtons[i].answered = true;
if (answerButtons[i].isCorrect) {
answerButtons[i].setCorrect();
} else {
answerButtons[i].setWrong();
}
}
if (isCorrect) {
LK.getSound('correct').play();
var timeBonus = Math.floor(timeRemaining / timePerQuestion * 50);
var streakBonus = streak * 10;
var points = 100 + timeBonus + streakBonus;
LK.setScore(LK.getScore() + points);
streak++;
if (streak > maxStreak) {
maxStreak = streak;
}
} else {
LK.getSound('wrong').play();
streak = 0;
}
scoreText.setText('Score: ' + LK.getScore());
streakText.setText('Streak: ' + streak);
LK.setTimeout(function () {
currentQuestion++;
startQuestion();
}, 2000);
}
function endGame() {
gameEnded = true;
// Save high score
var highScore = storage.highScore || 0;
if (LK.getScore() > highScore) {
storage.highScore = LK.getScore();
}
storage.maxStreak = Math.max(storage.maxStreak || 0, maxStreak);
storage.gamesPlayed = (storage.gamesPlayed || 0) + 1;
if (LK.getScore() >= 800) {
LK.showYouWin();
} else {
LK.showGameOver();
}
}
// Timer update
game.update = function () {
if (gameEnded) return;
// Update timer
var ticksPassed = LK.ticks - questionStartTime;
var secondsPassed = ticksPassed / 60;
timeRemaining = Math.max(0, timePerQuestion - secondsPassed);
// Update timer bar
var timerPercent = timeRemaining / timePerQuestion;
timerBar.width = 1800 * timerPercent;
// Check if time ran out
if (timeRemaining <= 0) {
LK.getSound('tick').play();
answerQuestion(false);
return;
}
// Timer warning sound
if (timeRemaining <= 3 && timeRemaining > 2.95) {
LK.getSound('tick').play();
}
};
// Start first question
startQuestion(); ===================================================================
--- original.js
+++ change.js
@@ -80,49 +80,49 @@
var gameEnded = false;
var questionStartTime = 0;
var streak = 0;
var maxStreak = 0;
-// Movie trivia questions data
+// Movie trivia questions data - General knowledge that doesn't require watching movies
var movieQuestions = [{
- question: "Which movie features the quote: 'May the Force be with you'?",
- answers: ["Star Wars", "Star Trek", "Guardians of Galaxy", "Avatar"],
+ question: "What year was the first Star Wars movie released?",
+ answers: ["1975", "1977", "1979", "1981"],
+ correct: 1
+}, {
+ question: "Which movie studio is famous for the lion logo?",
+ answers: ["Warner Bros", "MGM", "Paramount", "Universal"],
+ correct: 1
+}, {
+ question: "What does 'CGI' stand for in movies?",
+ answers: ["Computer Generated Images", "Cinema Graphics Interface", "Creative Graphics Integration", "Computer Gaming Interface"],
correct: 0
}, {
- question: "In which movie does Tom Hanks say 'Life is like a box of chocolates'?",
- answers: ["Cast Away", "Forrest Gump", "Philadelphia", "Saving Private Ryan"],
+ question: "Which city is known as the center of the American film industry?",
+ answers: ["New York", "Los Angeles", "Chicago", "Miami"],
correct: 1
}, {
- question: "Which film won the Academy Award for Best Picture in 2020?",
- answers: ["1917", "Joker", "Parasite", "Once Upon a Time"],
- correct: 2
+ question: "What is the highest-grossing movie of all time (as of 2023)?",
+ answers: ["Titanic", "Avatar", "Avengers: Endgame", "Star Wars"],
+ correct: 1
}, {
- question: "Who directed the movie 'Inception'?",
- answers: ["Steven Spielberg", "Quentin Tarantino", "Christopher Nolan", "Martin Scorsese"],
+ question: "Which award ceremony honors achievements in cinema?",
+ answers: ["Grammy Awards", "Emmy Awards", "Academy Awards", "Tony Awards"],
correct: 2
}, {
- question: "In 'The Lion King', what kind of animal is Timon?",
- answers: ["Warthog", "Meerkat", "Mongoose", "Prairie Dog"],
+ question: "What does 'PG-13' mean in movie ratings?",
+ answers: ["Pretty Good 13+", "Parental Guidance 13+", "Prohibited Gambling 13+", "Professional Grade 13+"],
correct: 1
}, {
- question: "Which movie features the character Jack Sparrow?",
- answers: ["Pirates of Caribbean", "Treasure Island", "Captain Phillips", "Master and Commander"],
- correct: 0
+ question: "Which streaming service is owned by Disney?",
+ answers: ["Netflix", "Hulu", "Disney+", "Amazon Prime"],
+ correct: 2
}, {
- question: "What is the name of the coffee shop in 'Friends'?",
- answers: ["Central Perk", "The Grind", "Java Joe's", "Café Latte"],
+ question: "What is the name of the famous film festival in France?",
+ answers: ["Cannes", "Berlin", "Venice", "Toronto"],
correct: 0
}, {
- question: "Which actor played the Joker in 'The Dark Knight'?",
- answers: ["Jack Nicholson", "Joaquin Phoenix", "Heath Ledger", "Jared Leto"],
- correct: 2
-}, {
- question: "In 'Finding Nemo', what type of fish is Nemo?",
- answers: ["Blue Tang", "Clownfish", "Angelfish", "Pufferfish"],
+ question: "How many Lord of the Rings movies are in the original trilogy?",
+ answers: ["2", "3", "4", "5"],
correct: 1
-}, {
- question: "Which movie features the song 'My Heart Will Go On'?",
- answers: ["The Notebook", "Titanic", "Ghost", "Dirty Dancing"],
- correct: 1
}];
// UI Elements
var questionDisplay = game.addChild(new QuestionDisplay());
questionDisplay.x = 1024;