colinvella

Using Arcade-Slopes plugin in Typescript

Recommended Posts

 

Hi,

I am trying to use the Arcade-Slopes plugin in Typescript, but I'm not sure how to do it.

I added a ref to the .d.ts file in tsconfig.json:

  "files": [
        "./src/app.ts",
        "./vendor/phaser.d.ts",
        "./vendor/phaser-arcade-slopes.d.ts"
    ]

This is how I'm trying to load the plugin.

        // enable arcade slopes plgin
        this.game.plugins.add(Phaser.Plugin.ArcadeSlopes);

But when I try to convert the collision layer:

// Convert the collision layer to work with Arcade Slopes
        this.game.slopes.convertTilemapLayer(this.collisionLayer, 'arcadeslopes');

I get the following errors:

src/app.ts(71,26): error TS2339: Property 'convertTilemapLayer' does not exist on type 'ArcadeSlopes'.
vendor/phaser-arcade-slopes.d.ts(61,5): error TS7010: 'resolve', which lacks return-type annotation, implicitly has an 'any' return type.
vendor/phaser-arcade-slopes.d.ts(156,17): error TS2304: Cannot find name 'object'.
vendor/phaser-arcade-slopes.d.ts(157,14): error TS2304: Cannot find name 'object'.
vendor/phaser-arcade-slopes.d.ts(238,3): error TS7010: 'clear', which lacks return-type annotation, implicitly has an 'any' return type.

It looks like the arcade slopes .d.ts file isn't compiling properly either.

Has anyone managed to use Arcade Slopes successfully with Typescript? I'm seriously considering restarting with plain old JS to avoid this problems.

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.