Search the Community
Showing results for tags 'tillingsprite'.
-
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,