Code edit (14 edits merged)
Please save this source code
User prompt
in thinkAboutTarget, when going to the other take into account attackDistance self.targetX = other.x; self.targetY = other.y;
User prompt
in mainAIMove, Implement acceleration and deceleration in the AI's movement. The AI could start moving slowly, gradually increase its speed as it moves away from its starting point, and then slow down as it approaches the target. This would add a more natural feel to the movement. Don't alter the other logic, only the movement
User prompt
Please fix the bug: 'TypeError: Math.rancomd is not a function' in or related to this line: 'if (Math.rancomd() < 0.5) {' Line Number: 367
Code edit (1 edits merged)
Please save this source code
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
===================================================================
--- original.js
+++ change.js
@@ -317,21 +317,18 @@
var angleToOpponent = Math.atan2(target.y - self.y, target.x - self.x) + Math.PI * 0.5;
self.body.rotation = angleToOpponent;
};
self.mainPlayerMove = function () {
- //var target = self.thinkAboutTarget();
self.mainAiMove();
};
self.thinkAboutTarget = function () {
+ if (!self.isPlayer) {
+ log("AI Search target...");
+ }
var other = self.isPlayer ? opponent : player;
// If Guard level < 25% or Energy < 25% retreat to closest ring corner
- if (self.energy < 5) {
- if (!self.retreat) {
- self.retreat = true;
- if (!self.isPlayer) {
- self.guard(true);
- }
- }
+ if (self.energy < 15) {
+ self.retreat = true;
if (!self.isPlayer) {
log("AI RETREAT !!!");
}
if (other.x > 1024) {
@@ -354,15 +351,15 @@
if (Date.now() - self.lastTargetReachTime < self.targetStayTimeMs) {
// Wait a bit before going to next target
return;
}
- var target = self.thinkAboutTarget();
+ 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;
- //self.guard(false);
if (!self.isPlayer) {
+ self.guard(false);
self.aiFight();
}
} else {
if (distanceToTarget > 10) {
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..