/**** * Initialize Game ****/ //<Assets used in the game will automatically appear here> //<Write entity 'classes' with empty functions for important behavior here> var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Create a text object to display the countdown //<Write game logic code here, including initializing arrays and variables> var countdownText = new Text2('30', { size: 150, fill: "#ffffff" }); countdownText.anchor.set(0.5, 0.5); countdownText.x = 2048 / 2; countdownText.y = 2732 / 2; game.addChild(countdownText); // Initialize the countdown timer var countdown = 30; // Function to update the countdown every second var countdownInterval = LK.setInterval(function () { countdown--; countdownText.setText(countdown.toString()); // Check if countdown has reached zero if (countdown <= 0) { LK.clearInterval(countdownInterval); showSurprise(); } }, 1000); // Function to show the surprise message function showSurprise() { var surpriseText = new Text2('LOL!', { size: 200, fill: "#ff0000" }); surpriseText.anchor.set(0.5, 0.5); surpriseText.x = 2048 / 2; surpriseText.y = 2732 / 2; game.addChild(surpriseText); }
/****
* Initialize Game
****/
//<Assets used in the game will automatically appear here>
//<Write entity 'classes' with empty functions for important behavior here>
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Create a text object to display the countdown
//<Write game logic code here, including initializing arrays and variables>
var countdownText = new Text2('30', {
size: 150,
fill: "#ffffff"
});
countdownText.anchor.set(0.5, 0.5);
countdownText.x = 2048 / 2;
countdownText.y = 2732 / 2;
game.addChild(countdownText);
// Initialize the countdown timer
var countdown = 30;
// Function to update the countdown every second
var countdownInterval = LK.setInterval(function () {
countdown--;
countdownText.setText(countdown.toString());
// Check if countdown has reached zero
if (countdown <= 0) {
LK.clearInterval(countdownInterval);
showSurprise();
}
}, 1000);
// Function to show the surprise message
function showSurprise() {
var surpriseText = new Text2('LOL!', {
size: 200,
fill: "#ff0000"
});
surpriseText.anchor.set(0.5, 0.5);
surpriseText.x = 2048 / 2;
surpriseText.y = 2732 / 2;
game.addChild(surpriseText);
}