Code edit (6 edits merged)
Please save this source code
User prompt
use gradientBackground as a background (create a backgroundImage class and use the asset; create a backgroundImage global; initialze the backgroundImage global in initialzeFunction and add it backgroundLayer)
Code edit (5 edits merged)
Please save this source code
User prompt
add levelBoardOffsetX and levelBoardOffsetY properties in PuzzleManager
Code edit (1 edits merged)
Please save this source code
User prompt
pass levelBoardOffsetX and levelBoardOffsetY to HexTile constructor
User prompt
in HexTile, use levelBoardOffsetX, levelBoardOffsetY parameters to offset graphics
User prompt
in HexTile, add new parameters levelBoardOffsetX, levelBoardOffsetY and use them to offset graphics
Code edit (8 edits merged)
Please save this source code
Code edit (25 edits merged)
Please save this source code
Code edit (14 edits merged)
Please save this source code
User prompt
remove usesText asset and its references
Code edit (6 edits merged)
Please save this source code
User prompt
Please fix the bug: 'tileSize is not defined' in or related to this line: 'var valueText = new Text2(self.type.toString(), {' Line Number: 103
User prompt
Please fix the bug: 'tileGraphics is not defined' in or related to this line: 'valueText.x = tileGraphics.x;' Line Number: 109
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'x')' in or related to this line: 'valueText.x = self.tileGraphics.x;' Line Number: 80
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'x')' in or related to this line: 'valueText.x = self.tileGraphics.x;' Line Number: 80
User prompt
Please fix the bug: 'tileGraphics is not defined' in or related to this line: 'valueText.x = tileGraphics.x;' Line Number: 109
User prompt
Please fix the bug: 'tileSize is not defined' in or related to this line: 'var valueText = new Text2(self.type.toString(), {' Line Number: 103
User prompt
Please fix the bug: 'tileGraphics is not defined' in or related to this line: 'valueText.x = tileGraphics.x;' Line Number: 109
Code edit (8 edits merged)
Please save this source code
User prompt
make operation buttons draggable
User prompt
in playing state handlers, make operation buttons draggable
Code edit (6 edits merged)
Please save this source code
User prompt
code if (obj && obj.parent instanceof OperationButton) { dragNode = obj.parent; } doesn't work. drageNode stay null when tapping operationButtons
===================================================================
--- original.js
+++ change.js
@@ -111,23 +111,8 @@
valueText.x = buttonGraphics.x;
valueText.y = buttonGraphics.y;
self.valueText = self.addChild(valueText);
// Functions
- // Dragging functionality
- self.down = function (x, y, obj) {
- self.dragging = true;
- self.dragOffsetX = x - self.x;
- self.dragOffsetY = y - self.y;
- };
- self.move = function (x, y, obj) {
- if (self.dragging) {
- self.x = x - self.dragOffsetX;
- self.y = y - self.dragOffsetY;
- }
- };
- self.up = function (x, y, obj) {
- self.dragging = false;
- };
return self;
});
// StartButton class to represent the start button
var StartButton = Container.expand(function () {
@@ -152,8 +137,9 @@
/****
* Game Code
****/
var interTileOffsetX = -2;
+var dragNode = null;
var interTileOffsetY = -0; // relative to interTileOffsetX
var tileSize = LK.getAsset('hexTile', {}).width + interTileOffsetX;
/************************************* GAME OBJECTS CLASSES ************************************/
/***********************************************************************************************/
@@ -501,8 +487,9 @@
}
function handlePlayingStateUp(x, y, obj) {
// Implement logic for handling up event in PLAYING state
log("Handling up event in PLAYING state");
+ dragNode = null;
}
function handleMenuStateUp(x, y, obj) {
// Implement logic for handling up event in MENU state
log("Handling up event in MENU state");
@@ -511,10 +498,14 @@
// Implement logic for handling move event in SCORE state
//log("Handling move event in SCORE state");
}
function handlePlayingStateMove(x, y, obj) {
- // Implement logic for handling move event in PLAYING state
//log("Handling move event in PLAYING state");
+ if (dragNode) {
+ dragNode.x = x;
+ dragNode.y = y;
+ }
+ //log("Handling move event in PLAYING state");
}
function handleMenuStateMove(x, y, obj) {
// Implement logic for handling move event in MENU state
//log("Handling move event in MENU state");
@@ -525,8 +516,11 @@
}
function handlePlayingStateDown(x, y, obj) {
// Implement logic for handling down event in PLAYING state
log("Handling down event in PLAYING state");
+ if (obj && obj.parent instanceof OperationButton) {
+ dragNode = obj.parent;
+ }
}
function handleMenuStateDown(x, y, obj) {
// Implement logic for handling down event in MENU state
log("Handling down event in MENU state");
tick
Sound effect
tileEntrance
Sound effect
tileRemove
Sound effect
operationSelect
Sound effect
operationCancel
Sound effect
tileChangeValue
Sound effect
resetSound
Sound effect
levelFailed
Sound effect
menuLevelSelect
Sound effect
menuCellEnter
Sound effect
applause
Sound effect
bgMusic
Music
tada
Sound effect