Jump to content

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");
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, 


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