User prompt
Fix the issue with timer text
User prompt
Make all the letters of the shape text Capital
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'y')' in or related to this line: 'timerTxt.y = trueButtonBackground.y - trueButtonBackground.height;' Line Number: 85
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'x')' in or related to this line: 'timerTxt.x = trueButtonBackground.x;' Line Number: 82
User prompt
x-axis value of timer text should be same as the true button.
User prompt
mobe timer text little bit down
User prompt
show timer text inbetween the buttons
User prompt
show timer below the shape text
User prompt
Please fix the bug: 'Timeout.tick error: timerTxt.getText is not a function' in or related to this line: 'var timeLeft = parseInt(timerTxt.getText().split(' ')[1]);' Line Number: 177
User prompt
on choosing incorrect option, game over
User prompt
each time when player clicks the eather of the button, restart the time.
User prompt
timer still not updating
User prompt
timer text is not updating
User prompt
Time text is going out of the screen bondries
User prompt
show the timer on the screen
User prompt
add a timer of 3 sec, if the player is not selected the true or false in time, then game over and show the score, also if the score went to less than the 0 then game over.
User prompt
increase more
User prompt
only black screen
User prompt
nothing is visible now
User prompt
text is going behind the shape, and not properly visible
User prompt
text is going behind the shape, and not properly visible make it move forward, on the top of the shape.
User prompt
move the text below the shape
User prompt
Increase the size of the shapes to big
User prompt
Please fix the bug: 'Uncaught Error: [object Object]addChildAt: The index 1 supplied is out of bounds 0' in or related to this line: 'self.addChildAt(self.text, 1);' Line Number: 46
User prompt
increase the z-axis of the text\
/****
* Classes
****/
//<Assets used in the game will automatically appear here>
// Shape class to represent the shapes in the game
var Shape = Container.expand(function () {
var self = Container.call(this);
self.shapeType = null;
self.shapeGraphics = null;
self.setShape = function (type) {
self.shapeType = type;
if (self.shapeGraphics) {
self.removeChild(self.shapeGraphics);
}
self.shapeGraphics = self.attachAsset(type, {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2,
scaleY: 2
});
};
});
// Text class to represent the shape names in the game
var ShapeText = Container.expand(function () {
var self = Container.call(this);
self.text = new Text2('', {
size: 100,
fill: "#ffffff"
});
self.text.anchor.set(0.5, 0.5);
self.addChildAt(self.text, 1);
self.setText = function (text) {
self.text.setText(text);
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Initialize variables
var shapes = ['circle', 'square', 'triangle', 'hexagon', 'octagon', 'oval', 'pentagon', 'rectangle', 'rhombus'];
var currentShape = null;
var currentShapeText = null;
var score = 0;
var scoreTxt = new Text2('Score: 0', {
size: 100,
fill: "#ffffff"
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Create shape and text objects
var shape = new Shape();
shape.x = 2048 / 2;
shape.y = 2732 / 3;
game.addChildAt(shape, 0);
var shapeText = new ShapeText();
shape.addChild(shapeText);
// Function to update the shape and text
function updateShapeAndText() {
var randomShape = shapes[Math.floor(Math.random() * shapes.length)];
var randomText = shapes[Math.floor(Math.random() * shapes.length)];
shape.setShape(randomShape);
shapeText.setText(randomText);
currentShape = randomShape;
currentShapeText = randomText;
}
// Function to handle True button press
function handleTruePress() {
if (currentShape === currentShapeText) {
score++;
} else {
score--;
}
scoreTxt.setText('Score: ' + score);
updateShapeAndText();
}
// Function to handle False button press
function handleFalsePress() {
if (currentShape !== currentShapeText) {
score++;
} else {
score--;
}
scoreTxt.setText('Score: ' + score);
updateShapeAndText();
}
// Create True and False buttons
var trueButtonBackground = LK.getAsset('trueButtonBackground', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2,
scaleY: 2
});
game.addChild(trueButtonBackground);
trueButtonBackground.x = 2048 / 4;
trueButtonBackground.y = 2732 * 3 / 4;
var trueButton = new Text2('True', {
size: 200,
fill: "#00ff00"
});
trueButtonBackground.addChild(trueButton);
trueButton.anchor.set(0.5, 0.5);
trueButton.x = 2048 / 4;
trueButton.y = 2732 * 3 / 4;
game.addChild(trueButton);
var falseButtonBackground = LK.getAsset('falseButtonBackground', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2,
scaleY: 2
});
game.addChild(falseButtonBackground);
falseButtonBackground.x = 2048 * 3 / 4;
falseButtonBackground.y = 2732 * 3 / 4;
var falseButton = new Text2('False', {
size: 200,
fill: "#ff0000"
});
falseButtonBackground.addChild(falseButton);
falseButton.anchor.set(0.5, 0.5);
falseButton.x = 2048 * 3 / 4;
falseButton.y = 2732 * 3 / 4;
game.addChild(falseButton);
// Add event listeners for buttons
trueButton.down = function (x, y, obj) {
handleTruePress();
};
falseButton.down = function (x, y, obj) {
handleFalsePress();
};
// Initialize the game with the first shape and text
updateShapeAndText();