Code edit (5 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'anchor')' in or related to this line: 'scoreTxt.anchor.set(0.5, 0);' Line Number: 132
Code edit (2 edits merged)
Please save this source code
User prompt
when a word is correct, remove it from the levels[currentLevel].words array
Code edit (1 edits merged)
Please save this source code
Code edit (15 edits merged)
Please save this source code
User prompt
make a small star explosion on the blackboard when a word is correct
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: blackBoardText is not defined' in or related to this line: 'blackBoardArr.push(blackBoardText);' Line Number: 129
Code edit (1 edits merged)
Please save this source code
User prompt
when a submitted word is incorrect, destroy the letters on the blackboard and reset the lettertiles to alpha 1 and being clickable
Code edit (17 edits merged)
Please save this source code
User prompt
when a submitted word is correct, add 1 point of score for each letter in the word and update a scorelabel with the new score
Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'letters')' in or related to this line: 'return levels[currentLevel].letters;' Line Number: 214
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: levels is not defined' in or related to this line: 'return levels[currentLevel];' Line Number: 240
Code edit (5 edits merged)
Please save this source code
User prompt
please populate the levels array with 10 sets of 3 letters and the words these can spell out
User prompt
each level should have it's letters, but also a set of acceptable words. please make a structure for that.
Code edit (8 edits merged)
Please save this source code
User prompt
once the first letter on each level is clicked, a submit button shoud appear below the leters
User prompt
once a letter is clicked, it should become 0.5 alpha and unclickable
User prompt
please adda black outline to backboardtext
Code edit (1 edits merged)
Please save this source code
/****
* Classes
****/
//<Assets used in the game will automatically appear here>
// Class for Letter Tiles
var LetterTile = Container.expand(function () {
var self = Container.call(this);
self.letter = '';
var tileGraphics = self.attachAsset('tile', {
anchorX: 0.5,
anchorY: 0.5
});
var letterText = new Text2(self.letter, {
size: 100,
fill: "#000000"
});
letterText.anchor.set(0.5, 0.5);
self.addChild(letterText);
self.setLetter = function (letter) {
self.letter = letter;
letterText.setText(letter);
};
self.down = function (x, y, obj) {
writeLetterOnBlackboard(self.letter);
};
return self;
});
var Teacher = Container.expand(function () {
var self = Container.call(this);
var teacherGraphics = self.attachAsset('teacher', {
anchorX: 0.5,
anchorY: 0.5
});
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
var blackboardOffsetX = 0;
function writeLetterOnBlackboard(letter) {
var blackboardText = new Text2(letter, {
size: 150,
fill: "#ffffff"
});
blackboardText.anchor.set(0.5, 0.5);
blackboardText.x = 500 + blackboardOffsetX;
blackboardText.y = 500;
game.addChild(blackboardText);
blackboardOffsetX += 100; // Adjust the offset value as needed
}
// Add background graphic object covering the whole screen
var background = LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2 - 50,
y: 2732 / 2 - 200
});
game.addChild(background);
var teacher = new Teacher();
teacher.x = 2048 / 2 + 380;
teacher.y = 2732 / 2 - 300;
game.addChild(teacher);
// Function to reset the game state for the new level
function resetGameStateForNewLevel() {
// Logic to reset the game state for the new level
// For example, clear the board, reset the score, etc.
displayLettersInLine();
}
// Function to display letters in a circle
function displayLettersInCircle() {
var centerX = 2048 / 2;
var centerY = 2732 * 0.75;
var radius = 300;
// Add larger circle behind the letters
var largerCircle = LK.getAsset('largerCircle', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 10,
scaleY: 10
});
largerCircle.x = centerX;
largerCircle.y = centerY;
game.addChild(largerCircle);
var angleStep = 2 * Math.PI / letters.length;
for (var i = 0; i < letters.length; i++) {
var angle = i * angleStep + Math.PI / 2;
var x = centerX + radius * Math.cos(angle);
var y = centerY + radius * Math.sin(angle);
var letterTile = new LetterTile();
letterTile.setLetter(letters[i]);
letterTile.x = x;
letterTile.y = y;
game.addChild(letterTile);
}
}
// Function to display letters in a line centered at height 2000
function displayLettersInLine() {
var startX = 2048 / 2 - letters.length * 220 / 2;
var y = 2000;
for (var i = 0; i < letters.length; i++) {
var x = startX + i * 220;
var letterTile = new LetterTile();
letterTile.setLetter(letters[i]);
letterTile.x = x;
letterTile.y = y;
game.addChild(letterTile);
}
}
// Function to advance to the next level
function advanceToNextLevel() {
if (currentLevel < levels.length - 1) {
currentLevel++;
letters = getLettersForCurrentLevel();
resetGameStateForNewLevel();
} else {
console.log("All levels completed!");
}
}
// Define levels with different sets of letters
var levels = [['N', 'W', 'O'], ['F', 'G', 'H', 'I', 'J'], ['K', 'L', 'M', 'N', 'O'], ['P', 'Q', 'R', 'S', 'T'], ['U', 'V', 'W', 'X', 'Y'], ['Z', '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', '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', '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', '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'], ['A', 'B', 'C', 'D', 'E'], ['F', 'G', 'H', 'I', 'J'], ['K', 'L', 'M', 'N', 'O'], ['P', 'Q', 'R', 'S', 'T']];
// Initialize the first level's letters and show level 1 when the game starts
var currentLevel = 0;
var letters = getLettersForCurrentLevel();
displayLettersInLine();
// Current level index
// Function to get letters for the current level
function getLettersForCurrentLevel() {
return levels[currentLevel];
}
// Initialize variables
// Update function
game.update = function () {
// Game update logic
};
A smooth, clean, blank and empty scrabble tile for a game.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A clean, warm and welcoming classroom in a school, facing the blackboard.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A small golden star. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.