From 7a1b765ecfef3762c8dbcc317fa8823648661f51 Mon Sep 17 00:00:00 2001 From: sahmyool <67554336+sahmyooI@users.noreply.github.com> Date: Sat, 22 Jun 2024 10:39:29 +0100 Subject: [PATCH] can't park there mate --- src/scenes/components/MoveTo.js | 67 --------------------- src/scenes/components/components.components | 27 --------- src/scenes/components/components.js | 1 - 3 files changed, 95 deletions(-) delete mode 100644 src/scenes/components/MoveTo.js diff --git a/src/scenes/components/MoveTo.js b/src/scenes/components/MoveTo.js deleted file mode 100644 index 48e2286e..00000000 --- a/src/scenes/components/MoveTo.js +++ /dev/null @@ -1,67 +0,0 @@ -/* START OF COMPILED CODE */ - -/* START-USER-IMPORTS */ -/* END-USER-IMPORTS */ - -export default class MoveTo { - constructor(gameObject) { - /** @type {Phaser.GameObjects.GameObject} */ - this.gameObject - /** @type {number} */ - this.x = 0 - /** @type {number} */ - this.y = 0 - - this.gameObject = gameObject - gameObject['__MoveTo'] = this - - /* START-USER-CTR-CODE */ - - // If x/y is 0 then use gameObject coordinate - this.x = this.x ? this.x : this.getX() - this.y = this.y ? this.y : this.getY() - - this.gameObject.on('pointerup', (pointer) => this.onPointerUp(pointer)) - - /* END-USER-CTR-CODE */ - } - - /** @returns {MoveTo} */ - static getComponent(gameObject) { - return gameObject['__MoveTo'] - } - - /* START-USER-CODE */ - - getX() { - let curObject = this.gameObject - let x = this.gameObject.x - while (curObject.parentContainer) { - x += curObject.parentContainer.x - curObject = curObject.parentContainer - } - return x - } - - getY() { - let curObject = this.gameObject - let y = this.gameObject.y - while (curObject.parentContainer) { - y += curObject.parentContainer.y - curObject = curObject.parentContainer - } - return y + 1 // +1 so you're below the object - } - - onPointerUp(pointer) { - if (pointer.button != 0) { - return - } - - this.gameObject.scene.shell.client.penguin.move(this.x, this.y) - } - - /* END-USER-CODE */ -} - -/* END OF COMPILED CODE */ diff --git a/src/scenes/components/components.components b/src/scenes/components/components.components index 7d477a79..86702575 100644 --- a/src/scenes/components/components.components +++ b/src/scenes/components/components.components @@ -317,33 +317,6 @@ } ] }, - { - "name": "MoveTo", - "baseClass": "", - "gameObjectType": "Phaser.GameObjects.GameObject", - "properties": [ - { - "name": "x", - "label": "x", - "tooltip": "x", - "defValue": 0, - "customDefinition": false, - "type": { - "id": "number" - } - }, - { - "name": "y", - "label": "y", - "tooltip": "y", - "defValue": 0, - "customDefinition": false, - "type": { - "id": "number" - } - } - ] - }, { "name": "Zone", "baseClass": "SimpleButton", diff --git a/src/scenes/components/components.js b/src/scenes/components/components.js index 55cf5147..722d79c3 100644 --- a/src/scenes/components/components.js +++ b/src/scenes/components/components.js @@ -3,7 +3,6 @@ export {default as Button} from './Button' export {default as Draggable} from './Draggable' export {default as DraggableContainer} from './DraggableContainer' export {default as Interactive} from './Interactive' -export {default as MoveTo} from './MoveTo' export {default as NineSlice} from './NineSlice' export {default as ShowHint} from './ShowHint' export {default as SimpleButton} from './SimpleButton'