Power Bar
deeno
Member Posts: 10
Im trying to make a power bar that would rise and fall when an actor is touched and when the touch is released, for the actor to shoot something depending on the power. Anybody know how to make this
Thanks
Comments
Google is your friend try doing a search like "power bar game salad" and you will find what you are looking for.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
There might be a better way of doing this, but at least for health bars I've just used a simple fix...
First off, you'll want to make a behavior so that when the actor is touched it changes the power attribute... you can do this a couple of ways, one being to constrain it to a graph or something like that, but what I might try something like this...
*N.B.: I used separate game and self attributes because the interpolate will complete even after release (at least it does on PC, although I think it's the same on Mac), so the game attribute can just capture where the self attribute currently is.
So now that we've got the attribute itself working, now for the visualization...
If the bar isnt just a simple image/color that can be stretched, you'll want to messing around the Graphics attribute, set something to Fixed (sorry, I'm on my phone right now, so I can't check :P). As for the actual growing and shrinking, on the power bar display actor, just put a Constrain self.Size.Height to [game.Power*#]. Replace that '#' with whatever number that will make the max power * # = max height of the power bar.
However, doing this will cause your power bar to grow from its center instead of at the top like you might want. If you aren't fine with that, then you'll also need to add another behavior, something like "Constrain self.Position.Y to self.BarBottomY+self.Size.Height/2
Well hope my lil attempt helps. Good luck with your project!
Thank you so much this was exactly what i was looking for.
+1, the forums are already stacked with very similar problems
It works but the power won't depend on how far up the power bar is.Anyone know how to fix this?
This is for a power meter but you can maybe get some help/idea on the math
Like Balls? Then click here! We've 100 coming soon