Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot load the plugin #11

Open
boris1dev opened this issue Feb 21, 2018 · 2 comments
Open

Cannot load the plugin #11

boris1dev opened this issue Feb 21, 2018 · 2 comments

Comments

@boris1dev
Copy link

Hi,
I'm trying to use the plugin in my TypeScript code.
I've installed the plugin via npm.
I've added the typescript definition file "phaser-nineslice.d.ts" to my tsconfig.json

In my preloader state I've added the plugin using

this.game.plugins.add(PhaserNineSlice.Plugin);

Directly after this line I've added

this.game.load.nineSlice('my-image', '/images/my-image.jpg', 25);

I get the error: "property nineSlice does not exist on type Loader"

I've spent a couple of hours to find a solutiion without any success.

I also tried to use directly the typescript code from your github project but I get also a bunch of error messages.

Any help really appreciated

Thanks

@alednik
Copy link

alednik commented Apr 21, 2018

Absolutely the same problem! Is there anybody who run with it plugin successfully?

@AleBles
Copy link
Member

AleBles commented Jun 29, 2018

You need to overwrite the game type to tell it's loader property has changed.

We do that by creating a custom interface that extends Phaser.Game, and set that type up in every state.

Interface: https://github.com/orange-games/phaser-ts-boilerplate/blob/master/ts/Fabrique/IGame.ts

So now in all our states we do:

public game: IGame;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants