User prompt
ok, obj.target parameter isn't useful: it's only the main game object. Only use x and y parameters to dertermine if an operation button was tapped
User prompt
Still drag doesn't work. Still dragNode is null. Please refer to game.down documentation to determine how to use the object properly
User prompt
``` if (obj && obj.parent && obj.parent.constructor.name === 'OperationButton') { dragNode = obj.parent; } ``` Analyze more deeply, you'll find that obj is an event from game.down handler, it contains a target property.
User prompt
drageNode stay null when tapping operationButtons Fix drag code code if (obj && obj.parent instanceof OperationButton) { dragNode = obj.parent; } doesn't work: unsing parent or parent.parent is not the way to detect objects classes.
User prompt
code if (obj && obj.parent instanceof OperationButton) { dragNode = obj.parent; } doesn't work. drageNode stay null when tapping operationButtons
Code edit (8 edits merged)
Please save this source code
User prompt
in playing state handlers, make operation buttons draggable
User prompt
make operation buttons draggable
Code edit (1 edits merged)
Please save this source code
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
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
Code edit (15 edits merged)
Please save this source code
User prompt
remove usesText asset and its references
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 HexTile, add new parameters levelBoardOffsetX, levelBoardOffsetY and use them to offset graphics
User prompt
in HexTile, use levelBoardOffsetX, levelBoardOffsetY parameters to offset graphics
User prompt
pass levelBoardOffsetX and levelBoardOffsetY to HexTile constructor
Code edit (5 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -501,11 +501,13 @@
// Playing State Handlers
function handlePlayingStateDown(x, y, obj) {
// Implement logic for handling down event in PLAYING state
log("Handling down event in PLAYING state", obj);
- if (obj && obj.target && obj.target.constructor.name === 'OperationButton') {
- dragNode = obj.target;
- }
+ puzzleManager.operations.forEach(function (operation) {
+ if (x >= operation.x - operation.width / 2 && x <= operation.x + operation.width / 2 && y >= operation.y - operation.height / 2 && y <= operation.y + operation.height / 2) {
+ dragNode = operation;
+ }
+ });
}
function handlePlayingStateMove(x, y, obj) {
log("Handling move event in PLAYING state", dragNode);
if (dragNode) {
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