ctran13 Posted October 19, 2014 Share Posted October 19, 2014 Hello, I've been looking through the documentations and forums but couldn't find anything for this and maybe was wondering if there was an easier way to do this. Basically, I'm making an Energy Bar (well, more like orbs ala Health and Mana from Diablo) and I was wondering if there was a way to clip an image in the same way as the progress bar. My workaround would be creating an alpha channel and making an image disappear in chunks that way, but I was hoping that there was an easier way to do this. Thanks. Link to comment Share on other sites More sharing options...
Behzat Posted October 19, 2014 Share Posted October 19, 2014 Well here is what i do. create(){ this.EnergyBarOriginalHeight = this.EnergyBar.height;}update(){ this.EnergyBar.height = (this.currentEnergy / this.maxEnergy) * this.EnergyBarOriginalHeight;}this will update the energybar every game tick. if hero is some how regenerates energy it will also fill towards original height. Link to comment Share on other sites More sharing options...
valueerror Posted October 19, 2014 Share Posted October 19, 2014 i am using a simple tilesprite as energy bar.. and then i simply adjust the width of this tilesrpite... thats it.. works like charm... Link to comment Share on other sites More sharing options...
lewster32 Posted October 20, 2014 Share Posted October 20, 2014 You can also do this with BitmapData objects like so: http://jsfiddle.net/lewster32/shodch8x/ Link to comment Share on other sites More sharing options...
Recommended Posts