Batzi 24 Report post Posted November 2, 2015 So I noticed that a lot of people in here were asking about a loading/progress bar so I came up with my own solution. Let me know what you thinkvar barGreen,barYellow,maxWidth,tween;function create(){ barGreen = game.add.graphics(200,300); barGreen.beginFill(0xEAF516); barGreen.drawRect(0,0,300,50); barYellow = game.add.graphics(200,300); barYellow.beginFill(0x4BFAF7); barYellow.drawRect(0,0,300,50); maxWidth = 300; barYellow.width=0; tween = game.add.tween(barYellow); tween.to({width:maxWidth},1000); tween.start();}Here's the JSFiddle if you want to see what it looks like: http://jsfiddle.net/Batzi/op3grg2w/10/ 3 nocaoper, WombatTurkey and MichaelD reacted to this Share this post Link to post Share on other sites
Get_Bentley 24 Report post Posted November 2, 2015 Looks good man! Definitely gave me a better understanding on how the loading bar works. Thanks. 1 Batzi reacted to this Share this post Link to post Share on other sites
Batzi 24 Report post Posted November 2, 2015 Looks good man! Definitely gave me a better understanding on how the loading bar works. Thanks.You're welcome! Share this post Link to post Share on other sites
ekeimaja 21 Report post Posted November 2, 2015 This is simpliest sample I've seen by now. Good work! 1 Batzi reacted to this Share this post Link to post Share on other sites
Batzi 24 Report post Posted November 2, 2015 This is simpliest sample I've seen by now. Good work! Thank you! I'm glad I could help Share this post Link to post Share on other sites
WombatTurkey 139 Report post Posted November 3, 2015 Great little snippet, good work Batzi Share this post Link to post Share on other sites
in mono 23 Report post Posted November 3, 2015 This is indeed maybe the simplest solution, but unfortunately it won't work for sprites that can't directly be scaled along x. Share this post Link to post Share on other sites
Skeptron 147 Report post Posted November 3, 2015 I don't get why people would struggle with load bars when all you need to do it just pass a sprite to the loader : http://phaser.io/docs/2.3.0/Phaser.Loader.html The loader will crop the bar accordingly, regarding the % of downloaded assets. Basically you don't have anything to code. ? 1 drhayes reacted to this Share this post Link to post Share on other sites
Batzi 24 Report post Posted November 3, 2015 This is indeed maybe the simplest solution, but unfortunately it won't work for sprites that can't directly be scaled along x.Well this is taking into account that no sprites are involved. The point of my code is to completely remove the need to use a sprite to crop. I needed it to do a progress bar for the game I am working on. Great little snippet, good work BatziThank you! 1 in mono reacted to this Share this post Link to post Share on other sites