James Cat Posted 15 hours ago Share Posted 15 hours ago Hi I am porting a game from C to JavaScript and usng pixiJS as the renderer. In the original C game there is a part in the code where a random number from 0 to 3 is generated, there is a texture that is 256 x 64 (4x1 of 64px tiles)and depending on the random number either the first, second, third or fourth tile is copied into the container. I have been through the docs on renderTexture but I am finding it hard to understand how to do the part where I take only a single tile (a rectangle) from the source image and render it onto the renderTexture, is it possible? many thanks for any help James Quote Link to comment Share on other sites More sharing options...
James Cat Posted 15 hours ago Author Share Posted 15 hours ago I think I figure it out new Texture({source: backStarTiles.source, frame: new Rectangle(TILE_WIDTH * randnum, 0, TILE_WIDTH, TILE_HEIGHT)}) Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted 15 hours ago Share Posted 15 hours ago (edited) Yes, this is right. Its just a region (set of UV's) without coping texture. Also, better to ask in official discord Edited 15 hours ago by ivan.popelyshev James Cat 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.