Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: self.gard is not a function' in or related to this line: 'self.gard(true);' Line Number: 360
Code edit (9 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: self.gard is not a function' in or related to this line: 'self.gard(true);' Line Number: 352
Code edit (5 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: target is undefined' in or related to this line: 'self.targetX = target.x;' Line Number: 370
User prompt
in thinkAboutTarget, when self.energy < 15, select a corner far from the other player
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: opponent.isPunching is not a function' in or related to this line: 'if (opponent.isPunching(opponent.leftHand.intersects(player.torso) || opponent.rightHand.intersects(player.torso))) {' Line Number: 860
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
in handleHit, fix the scope problem for members in the settimeout
Code edit (1 edits merged)
Please save this source code
User prompt
in handleHit, also use members array for the restoration of the positions
User prompt
in handleHit, move the members back in the setTimout function
User prompt
in handleHit, use members array to determine which members to move back and forth
Code edit (9 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: guardLevel is not defined' in or related to this line: 'if (guardLevel > 25) {' Line Number: 360
Code edit (1 edits merged)
Please save this source code
Code edit (14 edits merged)
Please save this source code
User prompt
add the opponent health bar at the top of the screen
Code edit (1 edits merged)
Please save this source code
Code edit (12 edits merged)
Please save this source code
User prompt
in handleHitImpact when KO call game over
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -321,23 +321,18 @@
self.retreat = true;
if (!self.isPlayer) {
log("AI RETREAT !!!");
}
- // Determine the farthest corner based on the opponent's position
- var opponent = self.isPlayer ? opponent : player;
- if (opponent.x < 1024) {
- // Opponent is closer to the left side, move to the right corner
- self.targetX = ring.rightCorner;
- } else {
- // Opponent is closer to the right side, move to the left corner
+ var other = self.isPlayer ? opponent : player;
+ if (other.x > 1024) {
self.targetX = ring.leftCorner;
- }
- if (opponent.y < 1366) {
- // Opponent is closer to the top, move to the bottom corner
- self.targetY = ring.bottomCorner;
} else {
- // Opponent is closer to the bottom, move to the top corner
+ self.targetX = ring.rightCorner;
+ }
+ if (self.y > 1024) {
self.targetY = ring.topCorner;
+ } else {
+ self.targetY = ring.bottomCorner;
}
} else {
self.retreat = false;
var target = self.isPlayer ? opponent : player;
@@ -345,13 +340,9 @@
self.targetY = target.y;
}
};
self.mainAiMove = function () {
- // Ensure target is defined before accessing its properties
- if (target) {
- self.targetX = target.x;
- self.targetY = target.y;
- }
+ var target = self.thinkAboutTarget();
// Check if athlete has reached the target
var distanceToTarget = Math.sqrt(Math.pow(self.targetX - self.x, 2) + Math.pow(self.targetY - self.y, 2));
if (!self.retreat && distanceToTarget < attackDistance) {
self.isInAttackRange = true;
clear
basic light gray convex round button with a red boxing glove icon. UI
Un gant de boxe bleu vu de dessus. video game
basic light round convex gray button with a raised blue shield icon.. UI
un éclair. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
remove
a basic white heart.. game icon
A boxer has lost the match..
man boxer with red gloves is KO on the ring..