Code edit (12 edits merged)
Please save this source code
User prompt
in gamePlaying(), invert opponents game.addChild order
Code edit (1 edits merged)
Please save this source code
Code edit (8 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'intersects')' in or related to this line: 'if (opponents[line - 1].intersects(obstacle.centralRod)) {' Line Number: 630
Code edit (13 edits merged)
Please save this source code
User prompt
reverse opponents spawn order
User prompt
reverse opponents spawn
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: Cannot read properties of undefined (reading 'restore')' in or related to this line: 'opponents[i].restore();' Line Number: 633
Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: Cannot read properties of undefined (reading 'restore')' in or related to this line: 'opponents[i].restore();' Line Number: 632
Code edit (3 edits merged)
Please save this source code
User prompt
in gameInitialize, after startButton init, on button press, call cleanMenuState and switch to playing state
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'on')' in or related to this line: 'startButton.on('down', function () {' Line Number: 419
User prompt
on button press, call cleanMenuState and switch to playing state
Code edit (1 edits merged)
Please save this source code
User prompt
add a button Asset at the center of the screen before the Start text. don't replace Start text
Code edit (1 edits merged)
Please save this source code
User prompt
add a button Asset at the center of the screen
Code edit (1 edits merged)
Please save this source code
User prompt
add a Start Text in the center of the screen
Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in or related to this line: 'for (var i = obstacles[line].length - 1; i >= 0; i--) {' Line Number: 529
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -354,8 +354,11 @@
var globalSpeedPerLine = [-10, -10];
var colorsArray = [0x1188FF, 0xFF0000, 0x00FF00, 0xFFFF00, 0xFF00FF, 0x00FFFF, 0xFFFFFF, 0xFF8811];
var isDebug = true;
var debugMarker;
+// UI
+var startText;
+var startButton;
/****************************************************************************************** */
/************************************** POSTURES ****************************************** */
/****************************************************************************************** */
var idlePosture = {
@@ -400,10 +403,11 @@
/****************************************************************************************** */
/************************************** INPUT HANDLERS ************************************ */
/****************************************************************************************** */
// Touch event to make the athlete jump
-game.on('down', function () {
- athlete.jump();
+startButton.on('down', function () {
+ cleanMenuState();
+ gameState = GAME_STATE.PLAYING;
});
/****************************************************************************************** */
/************************************* AI FUNCTIONS *************************************** */
/****************************************************************************************** */
@@ -453,20 +457,20 @@
opponents[i] = game.addChild(new Athlete(i + 1));
opponents[i].restore();
}
// Add Button in the center of the screen
- var startButton = LK.getAsset('button', {
+ startButton = LK.getAsset('button', {
anchorX: 0.5,
// Center the button horizontally
anchorY: 0.5,
// Center the button vertically
x: 2048 / 2,
// Position horizontally in the center
- y: 2732 / 2 - 150 // Position vertically above the start text
+ y: 2732 / 2 // Position vertically above the start text
});
game.addChild(startButton);
// Add Start Text in the center of the screen
- var startText = new Text2('START', {
+ startText = new Text2('START', {
size: 200,
fill: "#ffffff" // White color for better visibility
});
startText.anchor.set(0.5, 0.5); // Center the text horizontally and vertically
@@ -505,8 +509,12 @@
game.addChild(athlete);
// Check for collisions
checkForCollisions();
}
+function cleanMenuState() {
+ game.removeChild(startText);
+ game.removeChild(startButton);
+}
/****************************************************************************************** */
/************************************** GAME FUNCTIONS ************************************ */
/****************************************************************************************** */
function updateTracks() {
Elongated elipse with black top half and white bottom half.
full close and front view of empty stands. retro gaming style
delete
delete
Basquettes à ressort futuriste. vue de profile. Retro gaming style
a blue iron man style armor flying. Retro gaming style
a blue iron man style armor flying horizontally. Retro gaming style
round button with a big "up" arrow icon and a small line under it. UI
A big black horizontal arrow pointing left with centred text 'YOU' in capital letters, painted on an orange floor.. horizontal and pointing left
remove
gold athletics medal with ribbon. retro gaming style
a black oval with a crying smiley face.