Jump to content

How to size TilingSprite and run on single direction


Recommended Posts

Are you saying TilingSprite will only work for the whole stage that is entire application. Can I make it work inside a display container? I want to make the tiling image bigger.


For example:


// What is this width/height corresponds to, why is it set to renderer.width, can I set it to the texture size.
let tsprite = new TilingSprite(texture, width, height);

// I want to make the sprite bigger. Setting the width/height doesn't work. Why `tileScale` why not just `scale`?
tsprite.tileScale.x = 2;
tsprite.tileScale.y = 2;

// Now I don't know the width/height of this sprite I have to position it to the bottom. 
// Do I just have to eyeball the position and set it to some ratio of the displayHeight,
// so it becomes responsive?

// tsprite.position.y = displayHeight - tsprite.height
tsprite.position.y = displayHeight * 0.7;

Here's the demo https://eguneys.github.io/jsgames/work.html


And here's the repository: https://github.com/eguneys/orb

Edited by eguneys
Link to comment
Share on other sites

Tilingsprite is a sprite. No requirements for its size. Just make it "0.3*screen.height" , and position at the bottom , either like you did it, either by specifying anchor.y=1 and setting position to "screen.height"

I have a feeling that you didnt try to experiment with it enough.

Edited by ivan.popelyshev
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...