The title pretty much says it all.

Using the Phaser framework version 2.0, my IDE Visual Studio Express 2013 throws Property X does not exist errors with most physics related functions. For example when trying to initialize the physics system with this.game.physics.startSystem(Phaser.Physics.ARCADE);, I receive The property 'startSystem' does not exist on value of type 'Phaser.Physics.Arcade.World'.

I use TypeScript.

Might this be a problem of my phaser.d.ts (even though it's the newest one...)?

有帮助吗?

解决方案

for that particular error just modify it as this : https://github.com/photonstorm/phaser/blob/master/build/phaser.d.ts#L2803

as :

   class World {

            constructor(game: Phaser.Game, config: Object);

            applyDamping: boolean
            applyGravity: boolean;
            applySpringForces: boolean;
            bounds: any;
            collisionGroups: any[];
            emitImpactEvent: boolean;
            enableBodySleeping: boolean;
            friction: number;
            game: Phaser.Game;
            gravity: Phaser.Physics.Arcade.InversePointProxy;
            materials: Phaser.Physics.Arcade.Material[];
            onBeginContact: Phaser.Signal;
            onBodyRemoved: Phaser.Signal;
            onConstraintAdded: Phaser.Signal;
            onConstraintRemoved: Phaser.Signal;
            onContactMaterialAdded: Phaser.Signal;
            onContactMaterialRemoved: Phaser.Signal;
            onEndContact: Phaser.Signal;
            onImpact: Phaser.Signal;
            onPostBroadphase: Phaser.Signal;
            onPostStep: Phaser.Signal;
            onSpringAdded: Phaser.Signal;
            onSpringRemoved: Phaser.Signal;
            restitution: number;
            solveConstraints: boolean
            startSystem: Function; // was missing 
            time: boolean;
            world: any;

            addBody(body: Phaser.Physics.Arcade.Body): boolean;
            addConstraint(constraint: any)


        }

Be sure to send them a pull request to help the next guy.

其他提示

So the developer contacted me at their forums and told me that it really is due to the phaser.d.ts being outdated! It's being worked on. Also the github phaser dev branch already sports a newer version.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top