Creating a cast bar
beckb
Member Posts: 16
I'd like to have a cast bar show up at the same part of the screen every time a key is pressed. Is there a way to have it increase from zero to full on a certain timer? (E.g. 2-second cast, 3-second cast, etc.).
Many thanks.
Many thanks.
Comments
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Create a custom Attribute that takes note if a spell has been cast. When a spell is cast, set that Attribute to "true." Next tell the Timer to set that Attribute to "false" after X sec.
Now set all your spell Actors to do nothing when tapped whenever the custom Attribute is still "true."
I'm trying to create a horizontal cast bar where the left border is static (much like yours, where the bottom border of your life bar is static). So I'm trying to find a way to apply what's in your demo to my project. Thanks!
The reason for that is that GameSalad resizes actors while keeping their x/y values the same. So if you start to shrink a horizontal bar (rectangular actor), it will shrink from the sides instead of from only one side as you might expect and want. Therefore, to make it shrink from one side, we have to continually move it over towards the side we don't want to shrink. That's what the interpolate (or constrain) behaviors are for. For a horizontal bar, you would use self.size.width and self.position.X.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User