johhnyblagger Posted October 6, 2016 Share Posted October 6, 2016 Hi all, I have a sprite sheet, I want to make many sprites from this sprite sheet. Here is my implementation: var ASSET_PATHS: string[] = [ "assets/roguelikeSheet_transparent.png", "assets/roguelikeChar_transparent.png" ] PIXI.loader.add(ASSET_PATHS).load(hasLoaded); var texture1 = PIXI.utils.TextureCache["assets/roguelikeSheet_transparent.png"]; var rect1 = new PIXI.Rectangle(0*17,0*17,16,16); texture1.frame = rect1; var sprite1 = new PIXI.Sprite(texture); var texture2 = PIXI.utils.TextureCache["assets/roguelikeSheet_transparent.png"]; var rect2 = new PIXI.Rectangle(3*17,5*17,16,16); texture2.frame = rect2; var sprite2 = new PIXI.Sprite(texture); The code above is me trying to load two different sections of the same sprite sheet and make sprites from those sections. What happens is that: texture2.frame = rect2; overwrites sprite1's texture, thus both sprites become rect2's section. Quote Link to comment Share on other sites More sharing options...
johhnyblagger Posted October 6, 2016 Author Share Posted October 6, 2016 solution found, posted here 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.