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;
// General knowledge trivia questions - no movies required
var movieQuestions = [{
question: "What is the capital of Australia?",
answers: ["Sydney", "Canberra", "Melbourne", "Brisbane"],
correct: 1
}, {
question: "How many continents are there?",
answers: ["5", "6", "7", "8"],
correct: 2
}, {
question: "What is the largest planet in our solar system?",
answers: ["Saturn", "Jupiter", "Neptune", "Earth"],
correct: 1
}, {
question: "Which element has the chemical symbol 'O'?",
answers: ["Gold", "Silver", "Oxygen", "Iron"],
correct: 2
}, {
question: "How many sides does a hexagon have?",
answers: ["5", "6", "7", "8"],
correct: 1
}, {
question: "What is the smallest country in the world?",
answers: ["Monaco", "Vatican City", "San Marino", "Liechtenstein"],
correct: 1
}, {
question: "Which ocean is the largest?",
answers: ["Atlantic", "Indian", "Arctic", "Pacific"],
correct: 3
}, {
question: "What year did World War II end?",
answers: ["1944", "1945", "1946", "1947"],
correct: 1
}, {
question: "What is the hardest natural substance on Earth?",
answers: ["Gold", "Iron", "Diamond", "Platinum"],
correct: 2
}, {
question: "How many bones are there in an adult human body?",
answers: ["196", "206", "216", "226"],
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,48 +80,48 @@
var gameEnded = false;
var questionStartTime = 0;
var streak = 0;
var maxStreak = 0;
-// Movie trivia questions data - General knowledge that doesn't require watching movies
+// General knowledge trivia questions - no movies required
var movieQuestions = [{
- question: "What year was the first Star Wars movie released?",
- answers: ["1975", "1977", "1979", "1981"],
+ question: "What is the capital of Australia?",
+ answers: ["Sydney", "Canberra", "Melbourne", "Brisbane"],
correct: 1
}, {
- question: "Which movie studio is famous for the lion logo?",
- answers: ["Warner Bros", "MGM", "Paramount", "Universal"],
+ question: "How many continents are there?",
+ answers: ["5", "6", "7", "8"],
+ correct: 2
+}, {
+ question: "What is the largest planet in our solar system?",
+ answers: ["Saturn", "Jupiter", "Neptune", "Earth"],
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 element has the chemical symbol 'O'?",
+ answers: ["Gold", "Silver", "Oxygen", "Iron"],
+ correct: 2
}, {
- question: "Which city is known as the center of the American film industry?",
- answers: ["New York", "Los Angeles", "Chicago", "Miami"],
+ question: "How many sides does a hexagon have?",
+ answers: ["5", "6", "7", "8"],
correct: 1
}, {
- question: "What is the highest-grossing movie of all time (as of 2023)?",
- answers: ["Titanic", "Avatar", "Avengers: Endgame", "Star Wars"],
+ question: "What is the smallest country in the world?",
+ answers: ["Monaco", "Vatican City", "San Marino", "Liechtenstein"],
correct: 1
}, {
- question: "Which award ceremony honors achievements in cinema?",
- answers: ["Grammy Awards", "Emmy Awards", "Academy Awards", "Tony Awards"],
- correct: 2
+ question: "Which ocean is the largest?",
+ answers: ["Atlantic", "Indian", "Arctic", "Pacific"],
+ correct: 3
}, {
- question: "What does 'PG-13' mean in movie ratings?",
- answers: ["Pretty Good 13+", "Parental Guidance 13+", "Prohibited Gambling 13+", "Professional Grade 13+"],
+ question: "What year did World War II end?",
+ answers: ["1944", "1945", "1946", "1947"],
correct: 1
}, {
- question: "Which streaming service is owned by Disney?",
- answers: ["Netflix", "Hulu", "Disney+", "Amazon Prime"],
+ question: "What is the hardest natural substance on Earth?",
+ answers: ["Gold", "Iron", "Diamond", "Platinum"],
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"],
+ question: "How many bones are there in an adult human body?",
+ answers: ["196", "206", "216", "226"],
correct: 1
}];
// UI Elements
var questionDisplay = game.addChild(new QuestionDisplay());