batman Posted February 20, 2018 Share Posted February 20, 2018 Hi everyone, I am quite new in game dev and developing simple app using pixi.js and faced with the following issue: when I use simple sprite I can adjust scaling of sprite and it fit let say logic (using set.scale()), but when I change it to TillingSprite, it breaks any consistency for me. Could someone clarify scaling topic for me: 1. TillingSprite: as soon as I change sprite to TillinSprite I see only enlraged top area of asset spread on whole application stage. Reducing scale or size doesn`t display whole picture, it just reduce area of TillingSprite (picture). Please check my class below. I have played with different values of innerWidth/Height, but no desirable results achieved. What is correct way to scale TillingSprite? So scaling behaves the same as for Sprite: function Clouds() { var cloudsTexture = PIXI.Texture.fromImage("assets/images/clouds.png"); PIXI.extras.TilingSprite.call(this, cloudsTexture, innerWidth, innerHeight); //PIXI.Sprite.call(this, cloudsTexture); this.x = 0; this.y = 0; //this.scale.set(0.3, 0.3); this.tilePosition.x = 0; this.tilePosition.y = 0; }; //Clouds.prototype = Object.create(PIXI.Sprite.prototype); Clouds.prototype = Object.create(PIXI.extras.TilingSprite.prototype); Clouds.prototype.update = function () { this.tilePosition.x -= 0.8; } Thank you in advance, Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 20, 2018 Share Posted February 20, 2018 There's tileScale. batman 1 Quote Link to comment Share on other sites More sharing options...
batman Posted February 20, 2018 Author Share Posted February 20, 2018 Thank you, as always, so simple I should have guessed) Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 20, 2018 Share Posted February 20, 2018 And if you want rotation, there's "tileTransform.rotation" . "tileScale" and "tilePosition" are just a shortcut accessing for corresponding fields in tileTransform. https://github.com/pixijs/pixi.js/blob/dev/src/extras/TilingSprite.js#L104 batman 1 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.