Jump to content

Error set anchor Bitmaptext


Recommended Posts

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" });

why. Thanks

Link to comment
Share on other sites

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;

but when i use: let s = new Sprite(TextureCache["something"]), it say: Sprite doesn't have contructor has on parameter. Thanks

Link to comment
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.

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.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...