GithubHelp home page GithubHelp logo

Comments (4)

rroylance avatar rroylance commented on May 20, 2024

Hi, you should be able to just throw the js file into your assets folder and the game will automatically load it and the plugin will be available. You can then load and activate the plugin in your state's preload function, for example, using: this.game.plugins.add(new Phaser.Plugin.Isometric(this.game));

I haven't tried this exact plugin, but I can try it out this evening if you still can't get it going.

from phaser-ce-npm-webpack-typescript-starter-project.

amenant avatar amenant commented on May 20, 2024

Hi,
that's what I did but I get an error.

assets.ts (generated)

export namespace Scripts {
    export class ScriptPhaserPluginIsometricMin {
        static getName(): string { return 'phaser-plugin-isometric-min'; }

        static getJS(): string { return require('assets/script/phaser-plugin-isometric-min.js'); }
    }
}
preload(): void {
    this.game.plugins.add(new Phaser.Plugin.Isometric(this.game));
}

[ts] Property 'Isometric' does not exist on type 'typeof Plugin'.

Do I need to make an import? The plugin also provide a .ts file, do I have to make use of it?

Thanks.

from phaser-ce-npm-webpack-typescript-starter-project.

rroylance avatar rroylance commented on May 20, 2024

Oh, right, I never thought of needing the definitions for typescript when loading certain scripts... Oops.

Yes, you'll need to include the d.ts file in your project (I usually have a folder called definitions in the root (not assets)), and then in the tsconfig.json you need to add the path to the d.ts file to the files array.

That should tell typescript that the library exists and you should be good to go.

Thanks so much for bringing this to my attention, now I can add an additional tutorial or sorts to the readme :)

from phaser-ce-npm-webpack-typescript-starter-project.

amenant avatar amenant commented on May 20, 2024

Thanks 👍

from phaser-ce-npm-webpack-typescript-starter-project.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.