CurlyBrace Posted January 30, 2017 Share Posted January 30, 2017 Hey, do you have some code which implements something similar to the link, working for v4? Quote Link to comment Share on other sites More sharing options...
ClusterAtlas Posted February 1, 2017 Share Posted February 1, 2017 Things have changed in v4, I'll say a lot of it - but in a way that made things easier. I'll write a tutorial about this tonight, will publish tomorrow. Quote Link to comment Share on other sites More sharing options...
ClusterAtlas Posted February 2, 2017 Share Posted February 2, 2017 Done Check it out here: https://servercharlie.bitbucket.io/1-PIXI-Animated-Sprites.html I've listed 5 possible ways of doing it, and I'm still finishing up the other demos. But actually with the first demo + list of demos provided you'll already get the gist of it: You index everything you want to load into object, then you just iterate through them with 1.) the pixi loader, for loading the assets; and 2.) assigning the textures once assets are loaded, and 3.) switching the textures in-game. CurlyBrace 1 Quote Link to comment Share on other sites More sharing options...
CurlyBrace Posted February 2, 2017 Author Share Posted February 2, 2017 // Temporary 'frame object' now created. // 1.) Its texture is directly loaded from an Image. // - our sprite model is a cowgirl, // - with an 'Idle' animation where she just stands comfortably. // 2.) Take note of the 'time' property, // - it is length in milliseconds of how long to display the frame. // - we use 50ms, but you can experiment with higher/lower values. Temp_Frame = { texture: PIXI.Texture.fromImage(`./game_assets/cowgirl/Idle (${i}).png`), time: 50 }; @ServerCharlie Thanks for guide! Unfortunately, time property feature is undocumented and doesn't work for me. I am using last version of pixi.js - v4.3.4. Do I need dev version or something? Quote Link to comment Share on other sites More sharing options...
ClusterAtlas Posted February 3, 2017 Share Posted February 3, 2017 Not sure what you mean by "undocumented" but I was actually using the same v4.3.4 version in the example, I even went back moments ago and tested switching the 50ms to 100ms & 200ms, and it was actually working on my end I just checked the latest version's source on github btw, the 'time' property is already there as it should be: https://github.com/pixijs/pixi.js/blob/873ea67dd6167e2ddb1c2642a1bda0fd8a263e82/src/extras/AnimatedSprite.js#L3-L8 Quote Link to comment Share on other sites More sharing options...
CurlyBrace Posted February 3, 2017 Author Share Posted February 3, 2017 Indeed, I think I just misspelled something yesterday. It works now, About documentation: I was just confused how fromFrames is not using time property and missed actual constructor declaration. Duh http://pixijs.download/release/docs/PIXI.extras.AnimatedSprite.html#.fromFrames 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.