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
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
``` 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
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
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
Code edit (1 edits merged)
Please save this source code
User prompt
Ok, try to make operation buttons move smoother โช๐ก Consider importing and using the following plugins: @upit/tween.v1
Code edit (5 edits merged)
Please save this source code
User prompt
make drag anim duration depend on target x,y distance
Code edit (4 edits merged)
Please save this source code
User prompt
store initial operation buttons position in properties baseX and baseY
===================================================================
--- original.js
+++ change.js
@@ -68,10 +68,10 @@
fill: 0xEAEEE8,
dropShadow: false
});
valueText.anchor.set(0.5, 0.5);
- valueText.x = self.tileGraphics.x;
- valueText.y = self.tileGraphics.y - tileSize * 0.01;
+ valueText.x = tileGraphics.x;
+ valueText.y = tileGraphics.y - tileSize * 0.01;
self.valueText = self.addChild(valueText);
// Functions
self.playOperationEffect = function () {
// Play operation animation
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