Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: enter is not defined' in this line: 'self.enter = enter;' Line Number: 434
Code edit (5 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: columnIndex is not defined' in this line: 'if (!player.invulnerability && player.y > min && player.y < max && playerColumn >= column.index - 1 && playerColumn <= columnIndex + 1) {' Line Number: 387
Code edit (9 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: newColumn is undefined' in this line: 'var sideBox = newColumn.boxes[rowIndex];' Line Number: 580
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -546,11 +546,14 @@
var newB = (invB + Math.floor((0xFF - invB) * factor)) * Math.pow(16, 0);
playerGraphics.tint = newR + newG + newB;
}
if (targetDirection) {
- var moveSpeed = Math.min(targetX + self.x * targetDirection, PLAYER_MOVE_SPEED);
+ var moveSpeed = Math.min((targetX - self.x) * targetDirection, PLAYER_MOVE_SPEED);
self.x += moveSpeed * targetDirection;
playerGraphics.rotation = Math.PI * (column.index + self.x / BOX_WIDTH);
+ if (moveSpeed < PLAYER_MOVE_SPEED) {
+ targetDirection = 0;
+ }
}
if (self.airborne) {
verticalSpeed -= PLAYER_GRAVITY;
self.y -= verticalSpeed;
@@ -569,42 +572,34 @@
} else {
self.y = targetY;
}
}
+ var rowIndex = getRowIndex();
var overhang = Math.max(0, Math.abs(self.x) - BOX_WIDTH / 2);
if (overhang > 0) {
var newColumn = columnList[column.index + targetDirection];
- var newRowIndex = getRowIndex();
- var sideBox = newColumn.boxes[newRowIndex];
+ var sideBox = newColumn ? newColumn.boxes[rowIndex] : null;
var moveDist = BOX_WIDTH * targetDirection;
if (sideBox && !sideBox.falling) {
sideBox.touch(self);
self.x -= overhang * 2 * targetDirection;
- targetX -= moveDist;
+ targetX += moveDist;
targetDirection = -targetDirection;
playerGraphics.rotation = Math.PI * (column.index + self.x / BOX_WIDTH);
} else {
- newColumn.enter(self);
- targetX += moveDist;
- self.x += moveDist;
- var underBox = newColumn.boxes[newRowIndex - 1];
+ column = newColumn;
+ column.enter(self);
+ targetX -= moveDist;
+ self.x -= moveDist;
+ var underBox = column.boxes[rowIndex - 1];
if (!underBox || underBox.falling) {
self.airborne = true;
}
}
}
- if (!self.airborne) {
- var prevHeightIndex = Math.round(self.heightClimbed / BOX_HEIGHT);
- columnList[newColIndex].touch(self, newRowIndex - 1);
- if (newRowIndex > prevHeightIndex) {
- interface.increment((newRowIndex - prevHeightIndex) * POINTS_GAIN_CLIMBING);
- self.heightClimbed = newRowIndex * BOX_HEIGHT;
- if (newRowIndex >= SHIFT_THRESHOLD) {
- return true;
- }
- }
- }
- return false;
+ ;
+ ;
+ ;
}
function shift(amount) {
baseShift(amount);
;
Pixel art, side view of a concrete factory floor . Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Pixel art, square with cute eyes . Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Pixel art, square with the texture of a tnt . Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a crate, side view . Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a crate, flat side view . Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a crate, flat side view . Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Pixel art of a golden christmas present. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Pixel art of a green christmas present with red ribbons. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Pixel art of an elaborate green christmas present with red ribbons. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a metal background.
pixel art of a crate made of stone with a label of coal on the side, flat side view. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a square tnt explosion. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.