cristianbote / phaser-state-transition

State transition plugin for Phaser.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Typescript definition updates ?

iangregsondev opened this issue · comments

commented

Hi,

I am using typescript and works great with phaser, but adding this I get errors saying that StateTransition doesn't exist.

        this.game.state.start('TestPhase',
            Phaser.Plugin.StateTransition.Out.SlideLeft,
            Phaser.Plugin.StateTransition.In.SlideLeft,
            true,
            false,
            true
        );

Of course, this is probably to be expected as the StateTransition is added onto the Phaser.Plugin

Right now it uses the index.d.ts which is available in typings/global/phaser

I was wondering how to extend this types file, without having to edit the original typings file ?

Also wondered if it's possible to create a new method to start the transition instead of adding it on the phaser.Plugin - this may potentially break in the future as Phaser modifies this file, or adds a StateTransition of its own :-)

Any ideas the best way to tackle this would be really helpful.

Thanks

Good call!
I'll open a PR for it. Should be available as a standalone reference as well.

commented

Great! Thanks

Alright, so now you could add in your typings declare var StateTransition: any; if you want, but in any way, StateTransition is referenced on the window as well.

Let me know if there are any other issues.

PS: So, sorry for the delay.