lilsheep Posted June 19, 2015 Share Posted June 19, 2015 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) Quote Link to comment Share on other sites More sharing options...
Lauromine Posted June 19, 2015 Share Posted June 19, 2015 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 ...};andbackground = 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 Quote Link to comment Share on other sites More sharing options...
xerver Posted June 19, 2015 Share Posted June 19, 2015 Do you have a running example that shows that this doesn't work on jsfiddle or something? Your code looks fine, so there must be something going on elsewhere. Quote Link to comment Share on other sites More sharing options...
lilsheep Posted June 19, 2015 Author Share Posted June 19, 2015 It was an issue with the spritesheet. For some reason, when I set trim mode to trim, it didn't work. When I set it to crop..it works. 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.