Code edit (5 edits merged)
Please save this source code
User prompt
add a new button at bottom right for punch
Code edit (5 edits merged)
Please save this source code
User prompt
only move the human player with joystick
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: base is not defined' in or related to this line: 'var dx = localPos.x - base.x;' Line Number: 34
User prompt
Please fix the bug: 'ReferenceError: base is not defined' in or related to this line: 'var maxDistance = base.width / 2; // Max distance knob can move from center' Line Number: 31
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: joystick.knob is undefined' in or related to this line: 'var joystickDx = joystick.knob.x;' Line Number: 188
User prompt
make the player move using the joystick
Code edit (1 edits merged)
Please save this source code
User prompt
instruction knob.intersects(localPos) isn't normal, the knob should follow the user move until the base limit
User prompt
fix the joystick
User prompt
Please fix the bug: 'TypeError: knob.hitTest is not a function' in or related to this line: 'if (knob.hitTest(localPos)) {' Line Number: 34
User prompt
replace swipe system by the joystick system
User prompt
Please fix the bug: 'TypeError: knob.containsPoint is not a function' in or related to this line: 'if (knob.containsPoint(localPos)) {' Line Number: 34
User prompt
add a control joystick at the bottom left
Code edit (16 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: punchDistance is not defined' in or related to this line: 'self.leftArm.height += punchDistance;' Line Number: 119
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
log player.width when down
Code edit (3 edits merged)
Please save this source code
User prompt
set also swipeStart in 'down' event
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -73,18 +73,19 @@
self.punch = function (isLeft) {
var arm = isLeft ? self.leftArm : self.rightArm;
var forearm = isLeft ? self.leftForearm : self.rightForearm;
var hand = isLeft ? self.leftHand : self.rightHand;
+ var punchDistance = 40;
// Punch animation logic
LK.setTimeout(function () {
- arm.height += 20;
- forearm.y -= 20; // Move forearm up for punch
- hand.y -= 40; // Move hand up for punch
+ arm.height += punchDistance;
+ forearm.y -= punchDistance; // Move forearm up for punch
+ hand.y -= punchDistance * 2; // Move hand up for punch
}, 100);
LK.setTimeout(function () {
- arm.height -= 20;
- forearm.y += 20; // Reset forearm position
- hand.y += 40; // Reset hand position
+ arm.height -= punchDistance;
+ forearm.y += punchDistance; // Reset forearm position
+ hand.y += punchDistance * 2; // Reset hand position
}, 200);
};
// Update player position based on input
self.update = function () {
@@ -136,11 +137,11 @@
var touchPosition = null;
var swipeStart = null;
var swipeEnd = null;
game.down = function (x, y, obj) {
- var game_position = game.toLocal(obj.global);
+ swipeStart = game.toLocal(obj.global);
// Determine if tap is on the left or right half of the screen
- var isLeft = game_position.x < game.width / 2;
+ var isLeft = swipeStart.x < game.width / 2;
player.punch(isLeft);
};
game.move = function (x, y, obj) {
if (swipeStart) {
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..