How to use the phaser.Geom.Point function in phaser

To help you get started, we’ve selected a few phaser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github itsezc / CycloneIO / packages / client / source / rooms / pets / pet.ts View on Github external
let asset = this.getAssetFromAssets(assetName)
            let sourceName = assetName

            if (asset.source !== undefined) {
                sourceName = asset.source
            }

            try {
                const frameName = this.type + '_' + sourceName

                if (!this.spriteFrameExists(frameName)) {
                    return undefined
                }

                if (offset === undefined) {
                    offset = new Geom.Point(0, 0)
                }

                let layerSprite = new GameObjects.Sprite(this.scene, -Number(asset.x), -Number(asset.y), this.type, frameName).setOrigin(0, 0)

                if (this.direction > Directions.FRONT && this.direction < Directions.BEHIND) {
                    layerSprite.x -= offset.x
                }

                else {
                    layerSprite.x += offset.x
                }

                layerSprite.y += offset.y

                if (asset.flipH) {
                    layerSprite.scaleX = -1
github itsezc / CycloneIO / packages / client / source / rooms / pets / pet.ts View on Github external
if (frame === undefined) {
                frame = animationLayer.frameSequence.frame
            }

            if (frame.offsets === undefined) {
                return new Geom.Point(0, 0)
            }

            let offset = frame.offsets.offset[direction]

            if (offset.x === undefined && offset.y === undefined) {
                return new Geom.Point(0, 0)
            }

            return new Geom.Point(Number(offset.x), Number(offset.y))
        }

        return new Geom.Point(0, 0)
    }
github itsezc / CycloneIO / packages / client / source / rooms / pets / pet.ts View on Github external
}

            let frame = animationLayer.frameSequence.frame[frameId]

            if (frame === undefined) {
                frame = animationLayer.frameSequence.frame
            }

            if (frame.offsets === undefined) {
                return new Geom.Point(0, 0)
            }

            let offset = frame.offsets.offset[direction]

            if (offset.x === undefined && offset.y === undefined) {
                return new Geom.Point(0, 0)
            }

            return new Geom.Point(Number(offset.x), Number(offset.y))
        }

        return new Geom.Point(0, 0)
    }
github itsezc / CycloneIO / packages / client / source / rooms / model.ts View on Github external
private generate(heightmap: number[][]) {

        for (let y = 0; y < heightmap.length; y++) {

            for (let x = 0; x < heightmap[y].length; x++) {
                var coordinates = new Geom.Point(x, y)
                var isometricCoordinates = coordinatesToIsometric(coordinates)

                var tile = new GameObjects.Image(this.scene, isometricCoordinates.x, isometricCoordinates.y, 'tile')

                this.tiles.add(tile)
            }
        }

        this.scene.add.existing(this.tiles)
    }
}
github itsezc / CycloneIO / packages / client / source / rooms / pets / pet.ts View on Github external
}

            if (frame.offsets === undefined) {
                return new Geom.Point(0, 0)
            }

            let offset = frame.offsets.offset[direction]

            if (offset.x === undefined && offset.y === undefined) {
                return new Geom.Point(0, 0)
            }

            return new Geom.Point(Number(offset.x), Number(offset.y))
        }

        return new Geom.Point(0, 0)
    }