TonyFirgun Posted April 9, 2020 Share Posted April 9, 2020 Hello, I'm having trouble setting the texture of a sprite and pointing it to a loaded json resource. Any help would be greatly appreciated this.spriteSrc = PIXI.gfxLoader.resources['images/models/man.json'].spritesheet this.sprite.texture = new PIXI.Texture.from(this.spriteSrc.textures['stand_down/0.png']) Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted April 10, 2020 Share Posted April 10, 2020 you want a new texture to modify the frame , or you want old one? 1. "this.sprite.texture = this.spriteSrc.textures['stand_down/0.png']" should do it. 2. "PIXI.Texture.from()" is used to get by name from cache, from every spritesheet, you can just pass your 'stand_down/0.png' there. If it doesnt work, please specify more details. Check obvious things like whether your "textures" have that key at all Quote Link to comment Share on other sites More sharing options...
TonyFirgun Posted April 10, 2020 Author Share Posted April 10, 2020 54 minutes ago, ivan.popelyshev said: you want a new texture to modify the frame , or you want old one? 1. "this.sprite.texture = this.spriteSrc.textures['stand_down/0.png']" should do it. 2. "PIXI.Texture.from()" is used to get by name from cache, from every spritesheet, you can just pass your 'stand_down/0.png' there. If it doesnt work, please specify more details. Check obvious things like whether your "textures" have that key at all Oh thank you a ton, that worked! I'm still quite a beginner to programming so I'm still trying to grasp my mind around all of this. Could you recommend me articles/tutorials/books I could read into to help me further my knowledge with pixi and javascript as a beginner? Thank you. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted April 10, 2020 Share Posted April 10, 2020 (edited) Find https://www.amazon.com/JavaScript-Definitive-Guide-Activate-Guides/dp/0596805527, there are many pirated versions in internets. Learning Pixi+JS at the same time is hard, because PixiJS team focused on clear internal code, not on clear advancement for people without pre-knowledge. To read that code you need some experience with JS, and to advance faster you have to use chrome devtools like professional who already debugged a few projects and has experience with finding strange JS-related bugs. If you need inputs or physics, or something else that pixi doesnt have from default package - i suggest to move to Phaser. You can always move back to pixi when you have more experience and know which things you need Edited May 27, 2020 by ivan.popelyshev mircha 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.