Sign in to follow this  

Using TillingSprite changes scalling of sprite

Recommended Posts

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");, cloudsTexture, innerWidth, innerHeight);
//, 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, 


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.