User prompt
Spawn 3 more letters at 1 time randomly
User prompt
make 3 more letters come up
User prompt
Make the square into letters of A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z
User prompt
Make the square into letters of A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P
Initial prompt
ABCDEFGHIJKLMNOP
/**** * Classes ****/ //<Assets used in the game will automatically appear here> //<Write imports for supported plugins here> // Class for the mysterious letters var MysteriousLetter = Container.expand(function () { var self = Container.call(this); var letterGraphics = self.attachAsset('letter', { anchorX: 0.5, anchorY: 0.5 }); // Randomly decide if the letter will disappear or stay for 5 seconds self.init = function () { if (Math.random() < 0.5) { // Letter will disappear LK.setTimeout(function () { self.destroy(); }, 1000); // Disappear after 1 second } else { // Letter will stay for 5 seconds LK.setTimeout(function () { self.destroy(); }, 5000); // Stay for 5 seconds } }; self.init(); }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Array to keep track of letters var letters = []; // Function to spawn a new letter function spawnLetter() { var newLetter = new MysteriousLetter(); newLetter.x = Math.random() * 2048; newLetter.y = Math.random() * 2732; letters.push(newLetter); game.addChild(newLetter); } // Set an interval to spawn letters every 2 seconds var spawnInterval = LK.setInterval(spawnLetter, 2000); // Update function called every game tick game.update = function () { // Remove letters that are no longer in the game for (var i = letters.length - 1; i >= 0; i--) { if (!letters[i].parent) { letters.splice(i, 1); } } };
/****
* Classes
****/
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Class for the mysterious letters
var MysteriousLetter = Container.expand(function () {
var self = Container.call(this);
var letterGraphics = self.attachAsset('letter', {
anchorX: 0.5,
anchorY: 0.5
});
// Randomly decide if the letter will disappear or stay for 5 seconds
self.init = function () {
if (Math.random() < 0.5) {
// Letter will disappear
LK.setTimeout(function () {
self.destroy();
}, 1000); // Disappear after 1 second
} else {
// Letter will stay for 5 seconds
LK.setTimeout(function () {
self.destroy();
}, 5000); // Stay for 5 seconds
}
};
self.init();
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Array to keep track of letters
var letters = [];
// Function to spawn a new letter
function spawnLetter() {
var newLetter = new MysteriousLetter();
newLetter.x = Math.random() * 2048;
newLetter.y = Math.random() * 2732;
letters.push(newLetter);
game.addChild(newLetter);
}
// Set an interval to spawn letters every 2 seconds
var spawnInterval = LK.setInterval(spawnLetter, 2000);
// Update function called every game tick
game.update = function () {
// Remove letters that are no longer in the game
for (var i = letters.length - 1; i >= 0; i--) {
if (!letters[i].parent) {
letters.splice(i, 1);
}
}
};