samid737 / phaser3-plugin-pathbuilder

Draw and edit Lines, Bezier Curves, Splines at runtime, explore your scene and export your paths to Phaser
https://samid737.github.io/pathbuilder/
MIT License
79 stars 10 forks source link

this.load.plugin('PathBuilder', "src/PathBuilder.js",'PathBuilder') is broken in Phaser 3.55.2 #35

Closed EugenDueck closed 2 years ago

EugenDueck commented 3 years ago

This Issue is about

Latest Phaser version: 3.55.2 Latest master/PathBuilder: https://raw.githubusercontent.com/samid737/phaser3-plugin-pathbuilder/master/dist/PathBuilder.js

Describe the Issue below:

The following, as documented in the README does not compile in TypeScript:

        this.load.plugin('PathBuilder', "src/PathBuilder.js",'PathBuilder');

The error I get is:

  TS2345: Argument of type '"PathBuilder"' is not assignable to parameter of type 'boolean'.

The TypeScript compiler is in fact right to complain, as the third parameter to the plugin() function is the boolean start.

Phaser 3 will perhaps just interpret it as true-ish, so that may be okay for non-TypeScript users.

I guess the reason for this problem is that the Phaser 3 API was different in the past, so perhaps doing something like this may be more forwards compatible, as it is independent of the order of arguments:

        this.load.plugin({
            key: "PathBuilder",
            url: "src/PathBuilder.js",
            mapping: "PathBuilder"
        });

(Not sure if "mapping" is what you had in mind for the third argument)

samid737 commented 2 years ago

Thanks for reporting this, i'll try to switch to a config object instead, that seems much better.