Code edit (1 edits merged)
Please save this source code
User prompt
when isReached and athlete had won, show the confettis
Code edit (14 edits merged)
Please save this source code
User prompt
add a confetti class to celebrate player victory
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: messageTextBig is not defined' in or related to this line: 'messageTextBig.visible = false;' Line Number: 548
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
in Billboard.setMessage, set nbLineFeeds to the number of line feeds in newMessage
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: currentMessage is not defined' in or related to this line: 'self.setMessage(currentMessage);' Line Number: 540
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (6 edits merged)
Please save this source code
User prompt
add a Text2 in the Billboard class
Code edit (4 edits merged)
Please save this source code
User prompt
add a Billboard class
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: jumpButtonHelpText is undefined' in or related to this line: 'jumpButtonHelpText.visible = true;' Line Number: 1686
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
implement setRoundColors use a random color for the tint except the 1st color '0x1188FF' which is fixed for the player (line 0)
===================================================================
--- original.js
+++ change.js
@@ -38,16 +38,16 @@
anchorY: 0.5,
scaleX: 1,
scaleY: 1,
rotation: 0.125,
- tint: 0x000000 //self.tint // TEMP DEBUG
+ tint: 0x000000
});
self.head = self.trunk.attachAsset('head', {
anchorX: 0.5,
anchorY: 2,
scaleX: 1,
scaleY: 1,
- tint: 0x000000 // self.tint
+ tint: 0x000000
});
self.rightArm = self.trunk.attachAsset('bodyPart', {
anchorX: 0.5,
anchorY: 0,
@@ -90,9 +90,11 @@
// Check if the target posture for hands and legs is reached
//log("self.targetPosture: " + self.targetPosture.name + " : self.rightHand.x: " + self.rightHand.x, " self.targetPosture.rightHand.x: " + self.targetPosture.rightHand.x);
var handsAndLegsReached = Math.abs(self.rightLeg.x - self.targetPosture.rightLeg.x) < 1 && Math.abs(self.rightLeg.y - self.targetPosture.rightLeg.y) < 1 && Math.abs(self.leftLeg.x - self.targetPosture.leftLeg.x) < 1 && Math.abs(self.leftLeg.y - self.targetPosture.leftLeg.y) < 1 && Math.abs(self.head.x - self.targetPosture.head.x) < 1 && Math.abs(self.head.y - self.targetPosture.head.y) < 1;
if (handsAndLegsReached) {
- log("handsAndLegsReached !");
+ if (self.lineIndex == 1) {
+ log("handsAndLegsReached !");
+ }
// Update currentPosture to the name of the targetPosture when hands and legs posture is reached
self.currentPosture = self.targetPosture.name;
self.targetPosture = null;
self.isChangingPosture = false;
@@ -227,19 +229,24 @@
if (self.isOnGround) {
// Running
self.leftLeg.height = 200;
self.leftArm.height = 200;
+ self.trunk.rotation = 0.125;
+ self.runAnim();
+ /*
if (globalSpeedPerLine[0] != 0) {
- self.isWaiting = false;
- self.trunk.rotation = 0.125;
- self.runAnim();
+ self.isWaiting = false;
+ self.trunk.rotation = 0.125;
+ self.runAnim();
} else {
- if (!self.isWaiting) {
- self.isWaiting = true;
- self.trunk.rotation = 0.0;
- self.setPosture(idlePosture);
- }
+ if (!self.isWaiting) {
+ log("NOW Player Waiting...");
+ self.isWaiting = true;
+ self.trunk.rotation = 0.0;
+ self.setPosture(idlePosture);
}
+ }
+ */
} else {
// Jumping
self.speedY += self.gravity * 2;
self.y += self.speedY * 2;
@@ -302,13 +309,13 @@
}
self.updatePosture();
};
self.jump = function () {
- if (self.isAI || Date.now() - self.lastJumpTime > self.interJumpDelayMs) {
+ if (self.isAi || Date.now() - self.lastJumpTime > self.interJumpDelayMs) {
if (self.isOnGround) {
self.isOnGround = false;
// Handle jump bonus
- if (!self.isAI && self.justTookBonus) {
+ if (!self.isAi && self.justTookBonus) {
self.nbJumps++;
if (self.nbJumps > nbBonusJumps) {
log("JUMPS FINISHED " + self.nbJumps);
self.justTookBonus = false;
@@ -329,13 +336,16 @@
}
};
self.runAnim = function () {
if (self.lineIndex == 1) {
- //log("Check finish for #3 at x=" + opponents[self.lineIndex].x + " vs " + (finishLine.x + 512));
+ log("runAnim #1...self.rightArm.rotation=" + self.rightArm.rotation);
}
- if (!self.isAI && speedGauge < 0.2) {
+ if (!self.isAi && speedGauge < 0.2) {
return;
}
+ if (self.lineIndex == 1) {
+ log("runAnim #1...go anim!");
+ }
var ocsilDelay = 5 * (self.isAi ? 1 : 2 - speedGauge);
var armsAmplitude = 0.5;
var legsAmplitude = 0.5;
// Simulate running by continuously balancing the arms and legs
@@ -355,9 +365,9 @@
self.head.width = 50 - 10 * (runningArmAngle * Math.PI * 0.5);
};
self.jumpAnim = function () {
if (self.lineIndex == 1) {
- //log("Check finish for #3 at x=" + opponents[line - 1].x + " vs " + (finishLine.x + 512));
+ log("jumpAnim #1...");
}
var ocsilDelay = 5;
var armsAmplitude = 1;
var runningArmAngle = Math.sin(LK.ticks / ocsilDelay) * armsAmplitude; // Oscillate arm angle to simulate running faster
@@ -509,25 +519,26 @@
var nbLineFeeds = (newMessage.match(/\r\n|\r|\n/g) || []).length;
self.messageText.y = 220 + 42 * nbLineFeeds;
self.messageText.setText(newMessage);
};
- self.setLevelMessage = function () {
+ self.setLevelMessage = function (go) {
var newMessage = "";
self.messageTextBig.visible = false;
switch (difficultyLevel) {
case 2:
- newMessage = "Level 2: Amateurs\r\n \r\n \r\n GET READY!";
+ newMessage = "Level 2: Amateurs\r\n \r\n \r\n ";
break;
case 3:
- newMessage = "Level 3: Pros\r\n \r\n \r\nGET READY!";
+ newMessage = "Level 3: Pros\r\n \r\n \r\n";
break;
case 4:
- newMessage = "Level 4: Super Heroes\r\n \r\n \r\n GET READY!";
+ newMessage = "Level 4: Super Heroes\r\n \r\n \r\n ";
break;
default:
- newMessage = "Level 1: Juniors\r\n \r\n \r\n GET READY!";
+ newMessage = "Level 1: Juniors\r\n \r\n \r\n ";
break;
}
+ newMessage += go ? "GO!" : "GET READY!";
billboard.setMessage(newMessage);
};
self.setMessage(self.welcomeMessage);
});
@@ -876,9 +887,9 @@
});
/*
x: 150,
y: 2732 - 115,
- */
+ */
self.speedX = globalSpeedPerLine[0];
self._update_migrated = function () {
self.speedX = globalSpeedPerLine[0];
self.x += self.speedX;
@@ -980,9 +991,9 @@
// Purple
0x008080 // Teal;
];
var currentRoundColors = [];
-var isDebug = false;
+var isDebug = true;
var debugMarker;
// UI
var hintMobileText;
var startText;
@@ -1294,25 +1305,25 @@
// Spawn obstacles
spawnObstacles();
// Add starting blocks to each athlete's starting position
for (var i = 0; i <= numberOfOpponents; i++) {
- startingBlocks[i] = new StartingBlocks(startX + 20 + 100 * i, linesGroundLevels[i] + 145, i);
+ startingBlocks[i] = new StartingBlocks(startX + 10 + 100 * i, linesGroundLevels[i] + 145, i);
game.addChild(startingBlocks[i]);
}
// Initialize opponents
for (var i = numberOfOpponents - 1; i >= 0; i--) {
opponents[i] = game.addChild(new Athlete(i + 1));
opponents[i].restore();
opponents[i].isRunning = false;
opponents[i].setPosture(startingBlockPosture);
- opponents[i].y += 150;
+ opponents[i].y += 120;
}
// Initialize athlete
athlete = game.addChild(new Athlete(0));
athlete.restore();
athlete.isRunning = false;
athlete.setPosture(startingBlockPosture);
- athlete.y += 150;
+ athlete.y += 120;
runButton = LK.getAsset('runButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 4,
@@ -1365,9 +1376,9 @@
runButtonHelpText.visible = false;
jumpButtonHelpText.visible = false;
}
function gameStarting() {
- log("gameStarting...");
+ //log("gameStarting...");
for (var i = 0; i <= numberOfOpponents; i++) {
var athletes = [athlete].concat(opponents);
athletes[i]._update_migrated();
}
@@ -1385,18 +1396,19 @@
LK.gui.top.addChild(scoreTxt); // Add the score text to the GUI overlay at the top center
currentFinishPosition = 1;
// Remove starting blocks offset
for (var i = numberOfOpponents - 1; i >= 0; i--) {
- opponents[i].y -= 150;
+ opponents[i].y -= 120;
}
- athlete.y -= 150;
+ athlete.y -= 120;
speedGauge = 0.6;
globalSpeedPerLine[0] = globalBaseSpeed * speedGauge;
drone = new DeliveryDrone(); // false for odd drone graphic
drone.prepare();
bonusManager.endBonus();
game.addChild(drone);
raceStartTime = Date.now();
+ billboard.setLevelMessage(true);
gameState = GAME_STATE.PLAYING;
}
function gamePlaying() {
//log("Game playing...");
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.