1

标题基本概括了所有内容。

使用Phaser 框架2.0 版,我的 IDE Visual Studio Express 2013 会Property X does not exist在大多数物理相关函数中抛出错误。例如,当尝试使用 初始化物理系统时this.game.physics.startSystem(Phaser.Physics.ARCADE);,我收到The property 'startSystem' does not exist on value of type 'Phaser.Physics.Arcade.World'.

我使用打字稿。

这可能是我的 phaser.d.ts 的问题(即使它是最新的......)?

4

2 回答 2

1

对于该特定错误,只需将其修改为:https ://github.com/photonstorm/phaser/blob/master/build/phaser.d.ts#L2803

作为 :

   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)


        }

请务必向他们发送拉取请求以帮助下一个人。

于 2014-03-17T12:37:22.593 回答
1

所以开发人员在他们的论坛上联系了我,并告诉我这确实是由于 phaser.d.ts 已经过时了!它正在处理中。github phaser dev 分支也已经有了更新的版本。

于 2014-03-17T12:51:56.700 回答