steveRoll Posted August 6, 2019 Share Posted August 6, 2019 I have this image which is just a set of cards. I know you can crop a texture by putting a Rectangle object in its frame property, but you can only do that for a single texture object. How can I have multiple sprites that use different cards, using multiple Rectangle objects? I know TexturePacker automatically generates a spritesheet that pixi.js can use, but that program is made to pack different images into a single image, and the image I have is already packed. ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
steveRoll Posted August 6, 2019 Author Share Posted August 6, 2019 Nevermind, turns out you can create a new texture using a texture and a rectangle. didn't know that ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted August 6, 2019 Share Posted August 6, 2019 Welcome to the forums! Yes, its a thing. new PIXI.Texture(baseTexture, new PIXI.Rectangle(100, 100, 20, 20)); you can even rotate the frame: https://pixijs.io/examples/#/textures/texture-rotate.js steveRoll 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.