Jump to content

TilingSprite no longer visible after resize


Recommended Posts

I resized the cobblestone_ground sprite from a height of 100 to a height of 16.


And now it is no longer visible.


The call to TilingSprite was changed from   PIXI.extras.TilingSprite.call(this, texture, 4000 + Math.abs(768/2), 100);  

to what is there now.


Any idea why this might be happening? I have been racking my head trying to figure out why.

function Background() {  var texture = PIXI.Texture.fromImage("cobblestone_ground.png");  PIXI.extras.TilingSprite.call(this, texture, 4000 + Math.abs(768/2), 16);   this.position.x = 1000-Math.abs(768/2);   this.position.y = 370;  this.tilePosition.x = 50;  this.tilePosition.y = 0 ;  ...more code};
..later on
    background = new Background();    MAIN.stage.addChild(background)
Link to comment
Share on other sites

Hi lilsheep,


Did your code work before resizing?


If not, I think doing something like :

function Background() {  var texture = PIXI.Texture.fromImage("cobblestone_ground.png");  this.sprite = PIXI.extras.TilingSprite.call(this, texture, 4000 + Math.abs(768/2), 16);   //the other lines ...};


background = new Background();MAIN.stage.addChild(background.sprite)

would work because you tried adding to the stage an object which cant be rendered => It should be a DisplayObject (I dont know much about TilingSprite and pixi v3 in general but it extends Sprite(and DisplayObject)).


I hope that will help :)

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...