rossi46 Posted October 15, 2018 Share Posted October 15, 2018 I use typescipt to code my app. When i create a bitmaptext and set anchor for it, but the typescript show error:"Property 'set' does not exist on type 'number | Point'. Property 'set' does not exist on type 'number'.". var txt = new PIXI.extras.BitmapText("0sfsfds", { font: "15px RockerSmall", align: "center" }); txt.anchor.set(0.5); why. Thanks Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 15, 2018 Share Posted October 15, 2018 It seems that someone wanted "txt.anchor = 0.5" to work in TS, that's why there's that type. Of course its a Point. Make a PR to pixi-typescript Quote Link to comment Share on other sites More sharing options...
rossi46 Posted October 15, 2018 Author Share Posted October 15, 2018 1 hour ago, ivan.popelyshev said: It seems that someone wanted "txt.anchor = 0.5" to work in TS, that's why there's that type. Of course its a Point. Make a PR to pixi-typescript Ok I will try. And how to extend PIXI.Sprite. I want to add some property to sprite like. PIXI.Sprite.value, PIXI.Sprite.inx... I create a class extends PIXI.Sprite: let class Sprite extends PIXI.Sprite{ value: number; inx: number; contructor(){ super(); } } but when i use: let s = new Sprite(TextureCache["something"]), it say: Sprite doesn't have contructor has on parameter. Thanks Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 15, 2018 Share Posted October 15, 2018 class Sprite extends PIXI.Sprite{ value: number; inx: number; contructor(texture: PIXI.Texture){ super(texture); } } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.