Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (8 edits merged)
Please save this source code
User prompt
add a random rotation to flowers when spawning
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: finalScaleX is not defined' in or related to this line: 'if (flowerGraphics.scaleX < finalScaleX) {' Line Number: 62
User prompt
also when spawning Flower, make them grow in size from 0 to their final size
User prompt
when spawning Flower, make them fade in with an alpha anim from 0 to 1, (don't use tween for that)
Code edit (7 edits merged)
Please save this source code
User prompt
when spawning Flower, make them fade in with an alpha anim from 0 to 1
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
in self.updateCornerPipeThirdPhase add logs for self.waterH x, y and dir
User prompt
add plenty of logs in updateCornerPipeFirstPhase and updateCornerPipeThirdPhase
Code edit (8 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: Cannot read properties of undefined (reading '0')' in or related to this line: 'var tileStr = level[row][col];' Line Number: 1149
Code edit (1 edits merged)
Please save this source code
User prompt
in flower class, make size random from 100% to 100% + sizeRatioRange %
Code edit (1 edits merged)
Please save this source code
User prompt
in flower class make position random around x,y within positionOffset range
===================================================================
--- original.js
+++ change.js
@@ -679,10 +679,10 @@
log("sin(rotation)=", Math.sin(rotation));
var isSinRot = !(Math.abs(Math.sin(rotation)) < 0.1);
var acceptAngle1 = isSinRot ? rotation + Math.PI / 2 : rotation;
var acceptAngle2 = isSinRot ? rotation + Math.PI : rotation - Math.PI / 2;
- acceptAngle1 = acceptAngle1 % (2 * Math.PI);
- acceptAngle2 = acceptAngle2 % (2 * Math.PI);
+ acceptAngle1 = (2 * Math.PI + acceptAngle1) % (2 * Math.PI);
+ acceptAngle2 = (2 * Math.PI + acceptAngle2) % (2 * Math.PI);
log("Checking if incoming match pipe entry:", acceptAngle1, " or ", acceptAngle2, " vs ", incomingDirection);
if (Math.abs(incomingDirection - acceptAngle1) < 0.1) {
outgoingDirection = acceptAngle2 + Math.PI;
}
@@ -702,9 +702,9 @@
else if (Math.abs(incomingDirection - (normalizedRotation + Math.PI / 2) % (2 * Math.PI)) < 0.1) {
outgoingDirection = (incomingDirection - Math.PI / 2 + 2 * Math.PI) % (2 * Math.PI);
log("CORNER: turning counterclockwise from", incomingDirection, "to", outgoingDirection);
}
- */
+ */
if (outgoingDirection !== undefined) {
// Convert angle to grid movement
var dx = Math.round(Math.cos(outgoingDirection));
var dy = -Math.round(Math.sin(outgoingDirection));
@@ -727,10 +727,11 @@
rotation += 2 * Math.PI;
}
return rotation % (2 * Math.PI);
};
- self.setRotation = function (rotation) {
+ self.setRotation = function (rot, rotation) {
if (typeof rotation === 'number') {
+ self.pipeContainer.rot = rot;
self.pipeContainer.rotation = self.normalizeRotation(rotation); //* Math.PI / 2 DBO
} else {
// Handle string rotations (legacy support)
switch (rotation) {
@@ -821,15 +822,41 @@
self.flow = false;
}
}
};
+ self.getFlowOrder = function (rot, dir) {
+ log("getFlowOrder rot=", rot, " / dir=", dir);
+ var normalOrder = true;
+ switch (rot) {
+ case 0:
+ normalOrder = true;
+ break;
+ case 1:
+ log("Case 1");
+ normalOrder = dir == 'rl' ? false : true;
+ break;
+ case 2:
+ normalOrder = false;
+ break;
+ case 3:
+ normalOrder = false;
+ break;
+ default:
+ log("ERROR in getFlowOrder : Unknown rotation ", rot);
+ }
+ return normalOrder;
+ };
self.updateCornerPipe = function () {
var progress = (LK.ticks - self.startFlowTicks) * self.flowSpeed;
var thirdSize = self.maxWaterCornerSize / 3;
var upRot = Math.abs(self.pipeContainer.rotation) % (2 * Math.PI) < 0.1 || Math.abs(self.pipeContainer.rotation - Math.PI / 2) % (2 * Math.PI) < 0.1;
- var normalOrder = upRot || self.pipeContainer.dir == 'bt' || self.pipeContainer.dir == 'rl';
+ var normalOrder = self.getFlowOrder(self.pipeContainer.rot, self.pipeContainer.dir); //upRot || self.pipeContainer.dir == 'bt' || self.pipeContainer.dir == 'rl';
log("updateCornerPipe: Choosing order for tile:", self.pipeContainer.rotation, self.pipeContainer.dir);
- log("upRot=", upRot, " (0 or PI/2) / dir=", self.pipeContainer.dir);
+ log("upRot=", upRot, " (0 or PI/2) / dir=", self.pipeContainer.dir, " normalOrder = ", normalOrder);
+ // TODO : Specific function take rotation (x4) + dir(x4) => order (Log x,y + tor + dir + => final)
+ // TODO : Specific function take rotation (x4) + dir(x4) => order (Log x,y + tor + dir + => final)
+ // TODO : Specific function take rotation (x4) + dir(x4) => order (Log x,y + tor + dir + => final)
+ // TODO : Specific function take rotation (x4) + dir(x4) => order (Log x,y + tor + dir + => final)
if (progress < thirdSize) {
// 0 or PI/2
if (normalOrder) {
self.updateCornerPipeFirstPhase(progress, thirdSize, false);
@@ -849,25 +876,32 @@
if (progress >= self.maxWaterCornerSize) {
self.flow = false;
}
};
+ // TODO : RENAME updateCornerPipeVerticalPart
self.updateCornerPipeFirstPhase = function (progress, thirdSize, reverted) {
+ // TODO : Specific function take rotation (x4) + dir(x4) => revertedV (Log x,y + rot + dir + => final)
+ // TODO : Specific function take rotation (x4) + dir(x4) => reverted (Log x,y + rot + dir + => final)
+ // TODO : Specific function take rotation (x4) + dir(x4) => reverted (Log x,y + rot + dir + => final)
+ // TODO : Specific function take rotation (x4) + dir(x4) => reverted (Log x,y + rot + dir + => final)
if (self.waterV) {
log("updateCornerPipeFirstPhase: Making waterV visible. Current progress:", progress, "Third size:", thirdSize);
self.waterV.visible = true;
self.waterV.height = reverted ? progress - thirdSize * 2 : progress;
log("updateCornerPipeFirstPhase: Updated waterV height to:", self.waterV.height);
// PI
if (Math.abs(self.pipeContainer.rotation - Math.PI) % (2 * Math.PI) < 0.1) {
log("updateCornerPipeFirstPhase: Case PI");
- self.waterV.rotation = (self.pipeContainer.rotation - Math.PI / 2) % (2 * Math.PI);
self.waterV.y = -7;
- self.waterV.x = -40;
+ self.waterV.x = -120;
+ //self.waterV.rotation = (self.pipeContainer.rotation - Math.PI / 2) % (2 * Math.PI);
//self.waterH.rotation = reverted ? Math.PI / 2 : -Math.PI / 2;
+ self.waterH.rotation = (self.pipeContainer.dir == 'rl' ? self.pipeContainer.rotation - Math.PI / 2 : self.pipeContainer.rotation + Math.PI / 2) % (2 * Math.PI);
self.waterV.tint = 0xFF0000;
}
}
};
+ // TODO : RENAME updateCornerPipeCentral
self.updateCornerPipeSecondPhase = function (progress, thirdSize) {
if (self.waterCorner) {
self.waterCorner.visible = true;
self.waterCorner.alpha = (progress - thirdSize) / thirdSize;
@@ -878,8 +912,9 @@
self.waterCornerCover.visible = true;
self.waterCornerCover.alpha = (progress - thirdSize) / thirdSize;
}
};
+ // TODO : RENAME updateCornerPipeHorizontalPart
self.updateCornerPipeThirdPhase = function (progress, thirdSize, reverted) {
if (self.waterH) {
log("updateCornerPipeThirdPhase: Making waterH visible. Current progress:", progress, "Third size:", thirdSize, " Tile Rot=", self.pipeContainer.rotation);
self.waterH.visible = true;
@@ -898,18 +933,18 @@
// 3*PI/2 => Vers le haut
// P/2 => => Vers le bas
// PI => Vers la gauche
// 0 => OK
- self.waterH.rotation = self.pipeContainer.rotation % (2 * Math.PI);
+ self.waterH.rotation = (self.pipeContainer.dir == 'rl' ? self.pipeContainer.rotation + Math.PI : self.pipeContainer.rotation) % (2 * Math.PI);
self.waterH.tint = 0x0000FF;
}
// PI
if (Math.abs(self.pipeContainer.rotation - Math.PI) % (2 * Math.PI) < 0.1) {
- log("updateCornerPipeThirdPhase: Case PI");
+ log("updateCornerPipeThirdPhase: Case PI; reverted=", reverted, " / self.pipeContainer.rotation=", self.pipeContainer.rotation);
//self.waterH.rotation = (self.pipeContainer.rotation + Math.PI / 2) % (2 * Math.PI);
- self.waterH.rotation = (reverted ? self.pipeContainer.rotation - Math.PI / 2 : self.pipeContainer.rotation + Math.PI / 2) % (2 * Math.PI);
- self.waterH.y = -140;
- self.waterH.x = 0;
+ self.waterH.rotation = (self.pipeContainer.dir == 'rl' ? self.pipeContainer.rotation - Math.PI / 2 : self.pipeContainer.rotation + Math.PI / 2) % (2 * Math.PI);
+ self.waterH.y = -80;
+ self.waterH.x = -5;
self.waterH.tint = 0xFF0000;
}
// 3*PI/2
if (Math.abs(self.pipeContainer.rotation - 3 * Math.PI / 2) % (2 * Math.PI) < 0.1) {
@@ -2147,8 +2182,9 @@
}
return {
fixed: parts[0] === this.FIXED,
type: parts[1],
+ rot: parseInt(parts[2]),
rotation: parseInt(parts[2]) * (Math.PI / 2) // Convert to radians
};
},
// Create a tile string from components
@@ -2216,15 +2252,20 @@
tile.gridCol = col;
// Set type and create pipe graphics
tile.setType(tileData.type, row, col, tileData.fixed);
// Set initial rotation
- tile.setRotation(tileData.rotation);
+ log("Set initial rotation:", tileData.rot);
+ tile.setRotation(tileData.rot, tileData.rotation);
// Set position
tile.updatePosition(row, col);
return tile;
}
+/* All Corners :
+ 0: [["F-E-0", "F-C-2", "F-C-3", ""], ["F-C-1", "F-C-0", "F-C-1", "F-C-3"], ["F-C-2", "F-C-3", "F-C-2", "F-C-0"], ["F-S-2", "F-C-1", "", "M-C-0"]],
+ 0: [["F-S-0", "F-C-2", "F-C-3", ""], ["F-C-1", "F-C-0", "F-C-1", "F-C-3"], ["F-C-2", "F-C-3", "F-C-2", "F-C-0"], ["F-E-2", "F-C-1", "", "M-C-0"]],
+*/
var levelConfigs = {
- 0: [["", "F-C-2", "M-H-0", "M-C-3"], ["", "F-E-2", "M-V-0", ""], ["", "", "", "F-V-0"], ["", "", "", "F-S-2"]],
+ 0: [["F-E-0", "F-C-2", "F-C-3", ""], ["F-C-1", "F-C-0", "F-C-1", "F-C-3"], ["F-C-2", "F-C-3", "F-C-2", "F-C-0"], ["F-S-2", "F-C-1", "", "M-C-0"]],
// Level 1
1: [["F-S-0", "", "", ""], ["F-V-0", "", "", ""], ["F-V-0", "", "M-H-0", ""], ["F-C-1", "F-H-0", "", "F-E-1"]],
// Level 2
2: [["", "M-V-0", "F-E-0", ""], ["", "M-C-0", "F-V-0", ""], ["", "", "", ""], ["F-S-3", "F-H-0", "", ""]],
straigth zenith view square light wooden pallet. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
straigth zenith view square wooden pallet with big screws in each corner Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
simple yellow rating star. Modern video game style
tileSlide
Sound effect
levelWon
Sound effect
tileBlocked
Sound effect
fountain
Sound effect
waterInPipe
Sound effect
bgMusic
Music
logoBounce
Sound effect
levelStart
Sound effect
bgMusic2
Music
flowerPop
Sound effect
roundResult
Sound effect
gameWon
Sound effect
resetSound
Sound effect
birds
Sound effect
birds2
Sound effect
birds3
Sound effect