User prompt
Reset game should respawn the box
User prompt
After box is destroyes, inatead of game over, take the game back to the start point.
Code edit (15 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: currentX is not defined' in this line: 'self.swipeEndX = currentX > self.x + self.width / 2 ? currentX : null;' Line Number: 196
User prompt
update swipestarx and swipeendx. it should only check if shipestartx is on the left side of the box, and the swipednx is on the right side of the ebox.
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: BoxPiece is not defined' in this line: 'var piece = new BoxPiece();' Line Number: 135
User prompt
add two different assets for boxpiece
User prompt
Fix Bug: 'ReferenceError: BoxBottom is not defined' in this line: 'var bottomPiece = new BoxBottom();' Line Number: 101
User prompt
Fix Bug: 'ReferenceError: BoxTop is not defined' in this line: 'var topPiece = new BoxTop();' Line Number: 92
Code edit (6 edits merged)
Please save this source code
User prompt
if player swipes from left to right to left in the box, it should be sliced in half creating a top and bottom piece. this should not affect the swipe up or double click listeners in the box class.
Code edit (2 edits merged)
Please save this source code
User prompt
Add a new slice method to slice the box into top and bottom part. The slice gesture should cut through the box horizontally. Once sliced the box should be destroyed. this should not affect the current swipe up or double click methods.
User prompt
Add a new slice method to slice the box into top and bottom part. The slice gesture should cut through the box horizontally. Once sliced the box should be destroyed.
User prompt
if a swipe start on the 20% of the left side of the box, and ends in the 20 % of the box, it should destroy the box.
Code edit (5 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'worldTransform')' in this line: 'var currentY = obj.event.getLocalPosition(self.parent).y;' Line Number: 159
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
move layers 100 pixels up and 100 pixels left
Code edit (2 edits merged)
Please save this source code
User prompt
remove axe layers
Code edit (3 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -11,10 +11,10 @@
});
var BottomBoxPiece = Container.expand(function () {
var self = Container.call(this);
var bottomBoxPieceGraphics = self.createAsset('bottomBoxPiece', 'Bottom Box Piece Graphics', 0.5, 0.5);
- self.velocityX = (Math.random() - 0.5) * 20;
- self.velocityY = (Math.random() - 0.5) * 20;
+ self.velocityX = (Math.random() - 0.5) * 60;
+ self.velocityY = (Math.random() - 0.5) * 60;
LK.on('tick', function () {
self.x += self.velocityX;
self.y += self.velocityY;
self.rotation += 0.1;
@@ -26,10 +26,10 @@
});
var TopBoxPiece = Container.expand(function () {
var self = Container.call(this);
var topBoxPieceGraphics = self.createAsset('topBoxPiece', 'Top Box Piece Graphics', 0.5, 0.5);
- self.velocityX = (Math.random() - 0.5) * 20;
- self.velocityY = (Math.random() - 0.5) * 20;
+ self.velocityX = (Math.random() - 0.5) * 60;
+ self.velocityY = (Math.random() - 0.5) * 60;
LK.on('tick', function () {
self.x += self.velocityX;
self.y += self.velocityY;
self.rotation += 0.1;
@@ -126,9 +126,9 @@
this.parent.addChild(bottomPiece);
}
};
self.spinAndShrink = function () {
- var frames = 60;
+ var frames = 50;
var frameCounter = 0;
var animationTick = function () {
self.scale.x -= 1 / frames;
self.scale.y -= 1 / frames;
@@ -191,16 +191,16 @@
}
lastTapTime = currentTime;
this.startPos = obj.event.getLocalPosition(self.parent);
startY = this.startPos.y;
- self.swipeStartX = this.startPos.x;
- self.swipeEndX = null;
+ self.swipeStartX = this.startPos.x < self.x - self.width / 2 ? this.startPos.x : null;
+ self.swipeEndX = currentX > self.x + self.width / 2 ? currentX : null;
self.swipeDirection = null;
});
self.on('move', function (obj) {
var currentY = self.parent ? obj.event.getLocalPosition(self.parent).y : 0;
var currentX = self.parent ? obj.event.getLocalPosition(self.parent).x : 0;
- if (startY - currentY > 50) {
+ if (startY - currentY > 100) {
isSwipingUp = true;
}
if (self.swipeStartX != null) {
if (self.swipeDirection === null) {
@@ -216,12 +216,13 @@
self.emit('swipeUp');
self.velocityY = -30;
isSwipingUp = false;
}
- if (self.swipeEndX != null && Math.abs(self.swipeEndX - self.swipeStartX) > self.width / 2) {
+ if (self.swipeEndX != null && Math.abs(self.swipeEndX - self.swipeStartX) > self.width / 4) {
console.log('Box sliced');
self.emit('slice');
self.createTopAndBottomPieces();
+ self.isSliced = true;
self.destroy();
}
self.swipeStartX = null;
self.swipeEndX = null;
@@ -348,9 +349,9 @@
axeLayers.x = axe.x = LK.stage.width - axe.width / 2 - 100 + 200;
axeLayers.y = axe.y = LK.stage.height - axe.height / 2 - 100 + 200;
axe.zIndex = -1;
var messageText = new Text2('(Box time! Ready, set, open!)', {
- size: 40,
+ size: 60,
fill: '#ffffff'
});
messageText.anchor.set(.5, .5);
messageText.y += 1500;
@@ -445,9 +446,9 @@
}
}
if (box && cap.x < 1) {
box.spinAndShrink();
- messageText.setText('(Down the drain it goes! I bet you can find another way...)');
+ messageText.setText('(Down the drain! I bet you can find another way...)');
box = null;
if (self.isDead) {
deadMessage.visible = true;
} else {
@@ -468,6 +469,19 @@
LK.setTimeout(function () {
LK.showGameOver();
}, 3000);
}
+ if (box && box.isSliced) {
+ messageText.setText('(Clean cut! whats next...?)');
+ LK.setTimeout(function () {
+ LK.showGameOver();
+ }, 3000);
+ box.destroy();
+ box = null;
+ if (self.isDead) {
+ deadMessage.visible = true;
+ } else {
+ aliveMessage.visible = true;
+ }
+ }
});
});
8-bit. cartoon. red button. do not touch! Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8-bit. cartoon. black tub stopper with chain. in game asset.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8-bit. cartoon. axe. in game asset. no shadow.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Break in case of emergency square. Ax drawing inside. simple. 8-bit. cartoon. blackand white.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Delete