User prompt
Fix Bug: 'TypeError: self.children.order is not a function' in this line: 'self.children.order(function (a, b) {' Line Number: 488
Code edit (3 edits merged)
Please save this source code
User prompt
player starts off being invulnerable for the invulnerability time
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: DEATH_CRUSH_STONE is not defined' in this line: 'self.deathReason = DEATH_CRUSH_STONE;' Line Number: 286
Code edit (1 edits merged)
Please save this source code
User prompt
when the interface's gameover function is called, display the death reason as a BorderedText below the score, and additionally call the hideInstructions function
Code edit (4 edits merged)
Please save this source code
User prompt
add a deathReason variable to the interface
Code edit (1 edits merged)
Please save this source code
Code edit (13 edits merged)
Please save this source code
User prompt
prevent box shadow scale being less than the `SHADOW_MIN_SCALE` value
User prompt
add a global called `SHADOW_MIN_SCALE` of value 0.1
User prompt
Fix Bug: 'ReferenceError: count is not defined' in this line: 'if (countdown <= 0) {' Line Number: 329
Code edit (1 edits merged)
Please save this source code
User prompt
Rename `shiftContainer` function to `shift` for all classes
User prompt
Fix Bug: 'ReferenceError: shift is not defined' in this line: 'self.shift = shift;' Line Number: 95
User prompt
Rename `shiftContainer` to `shift` for all classes
User prompt
Rename `shiftContainer` to `shift` for all classes
User prompt
Remove the unused shift variable from the shiftableContainer class only
User prompt
Rename every single occurrence of `baseShiftContainer` to `baseShift`
User prompt
Fix Bug: 'ReferenceError: baseShiftContainer is not defined' in this line: 'baseShiftContainer(amount);' Line Number: 574
User prompt
Fix Bug: 'ReferenceError: baseShiftContainer is not defined' in this line: 'baseShiftContainer();' Line Number: 119
User prompt
Rename every single occurrence of `baseShiftContainer` to `baseShift`
Code edit (3 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -78,9 +78,9 @@
scoreTxt.setText(score.toString());
LK.setScore(score);
}
function gameOver() {
- LK.effects.flashScreen(0xff0000, 1000);
+ LK.effects.flashScreen(0xFF0000, 1000);
var deathReasonTxt = self.addChild(new BorderedText(self.deathReason, {
y: scoreTxt.y + scoreTxt.height + 20,
anchor: {
x: .5
@@ -482,9 +482,14 @@
boxes.push(box);
}
}
}
- function enter(player, value) {}
+ function enter(player) {
+ self.addChild(player);
+ self.children.sort(function (a, b) {
+ return a.y - b.y;
+ });
+ }
});
var Player = ShiftableContainer.expand(function (x, y) {
var self = ShiftableContainer.call(this);
var baseShift = self.shift;
@@ -493,8 +498,11 @@
var floorHeight = y;
var targetColumn = Math.floor(x / BOX_WIDTH);
var playerGraphics = self.createAsset('player', 'Player character', .5, .5);
var hitboxGraphics = self.createAsset('hitbox', 'Player hitbox', .5, .5);
+ var invR = 0xFF;
+ var invG = 0xD7;
+ var invB = 0x00;
playerGraphics.width = PLAYER_SIZE;
playerGraphics.height = PLAYER_SIZE;
hitboxGraphics.width = PLAYER_SIZE * 0.6;
hitboxGraphics.height = PLAYER_SIZE * 0.8;
@@ -502,9 +510,9 @@
;
self.x = x;
self.y = y;
self.heightClimbed = BOX_HEIGHT;
- self.invulnerability = INVULNERABILITY_TIME;
+ self.invulnerability = 0;
self.airborne = false;
self.hitbox = hitboxGraphics;
self.move = move;
self.jump = jump;
@@ -536,14 +544,13 @@
var targetX = (targetColumn + 0.5) * BOX_WIDTH;
var targetY = BOX_LINE - columnList[colIndex].count * BOX_HEIGHT;
if (self.invulnerability > 0) {
self.invulnerability--;
- playerGraphics.tint = 0xFFD700;
- if (self.invulnerability === 60 || self.invulnerability === 30) {
- LK.effects.flashObject(playerGraphics, 0x00000, 1000);
- }
- } else {
- playerGraphics.tint = 0xFFFFFF;
+ var factor = 1 - Math.min(self.invulnerability, INVULNERABILITY_WARNING) / INVULNERABILITY_WARNING;
+ var newR = (invR + Math.floor((0xFF - invR) * factor)) * Math.pow(16, 4);
+ var newG = (invG + Math.floor((0xFF - invG) * factor)) * Math.pow(16, 2);
+ var newB = (invB + Math.floor((0xFF - invB) * factor)) * Math.pow(16, 0);
+ playerGraphics.tint = newR + newG + newB;
}
if (self.x !== targetX) {
var moveSpeed = Math.min(Math.abs(targetX - self.x), PLAYER_MOVE_SPEED);
self.x += Math.sign(targetX - self.x) * moveSpeed;
@@ -578,13 +585,19 @@
self.x = BOX_WIDTH * (0.5 + (newColIndex * 9 + colIndex * 10) / 19);
playerGraphics.rotation = Math.PI * (self.x - STAGE_WIDTH / 2) / (BOX_WIDTH * 2);
targetColumn = colIndex;
newColIndex = colIndex;
+ } else {
+ var underBox = column.boxes[newRowIndex - 1];
+ if (!underBox || underBox.falling) {
+ self.airborne = true;
+ }
}
+ column.enter(self);
}
if (!self.airborne) {
var prevHeightIndex = Math.round(self.heightClimbed / BOX_HEIGHT);
- columnList[newColIndex].touch(self, rowIndex - 1);
+ 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) {
@@ -613,8 +626,9 @@
var BOX_SPEED = 5;
var BOX_GRAVITY = 0.2;
var TNT_COUNTDOWN = 2 * STAGE_TICKS;
var INVULNERABILITY_TIME = 5 * STAGE_TICKS;
+var INVULNERABILITY_WARNING = STAGE_TICKS;
var COLUMN_VOLUME = Math.ceil(BOX_LINE / BOX_HEIGHT);
var PLAYER_SIZE = 0.8 * BOX_WIDTH;
var PLAYER_GRAVITY = 0.5;
var PLAYER_JUMP_SPEED = 20;
@@ -637,9 +651,9 @@
var SHIFT_AMOUNT = SHIFT_COUNT * BOX_HEIGHT / SHIFT_DURATION;
var INSTRUCTION_DURATION = 5 * STAGE_TICKS;
var DEATH_FALLDOWN = 'Fell into the factory!';
var DEATH_CRUSH_BOX = 'Crushed by a packing crate!';
-var DEATH_CRUSH_TNT = 'Crushed by an unarmed TNT!';
+var DEATH_CRUSH_TNT = 'Crushed by a freshly armed TNT!';
var DEATH_CRUSH_STONE = 'Crushed by the naughty list!';
var DEATH_TNT_BASIC = 'Blew up after arming a TNT!';
var DEATH_TNT_INSTA = 'Coal detonated a TNT... And you!';
var DEATH_TNT_CHAIN = 'Blew up in a chain reaction!';
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.