actionscript 3 sectioned health bar -
i'm still new actionscript valuable. game involves scottish bag piper being attacked haggis, , each time hit, 1 heart should disappear (there 3 in total)
i've gotten work first heart disappear after piper hit haggis
piper.addeventlistener(event.enter_frame, piper_damaged); function piper_damaged(event:event):void { if (piper.hittestobject(haggis)) { heart_one.visible = false; piper.gotoandplay(2); } }
thank in advance
is game using timeline inside of flash pro?
you have var holds number of hearts want display , each time there collisions can take away heart until there no hearts left.
var numberofhearts:number = 3;
piper.addeventlistener(event.enter_frame, piper_damaged); function piper_damaged(event:event):void { if (piper.hittestobject(haggis)) { if(numberofhearts > 0) { numberofhearts--; trace(numberofhearts); } } }
aftre need set heart objects in array , either make 1 took away not visible or better way remove array altogether.
Comments
Post a Comment