Making a Upgrading Button

xplosion28

  • Posts: 275
I'm trying to make a button that will continually be upgraded.  I'm trying to have 3 animations:

   -One animation is when you don't have the required resources, so nothing happens. (Default Animation)
   -One animation when you have the required resources so you can buy it.  (However I need to make it automatically change to this animation when you pass the needed resource which is my main challenge)
   -The last animation is when you hover over the button changing the animation when you have the required resources.

I can make the button work quite easily, I'm just having difficulty with the updating so that the animation will change automatically when you have enough resources to purchase it.  The only way I was able to fix that problem was removing the hover animation.

If needed I can add pictures of the code!

Thanks in advance:)

t4u

  • Posts: 418


- The answer is trigger events => Whenever you sell your resources you trigger event "1" that checks if you have required resources if you don't change animation to Deflaut Animation
- Don't understnad the bracket part
- I believe there is an event called Mouse on self in actor behavior. Use that.
USE PICTURES WHEN YOU ASK SOMETHING!
If I helped you be sure to mention it in your game.

Tutorials + downloads:
http://t4upl.blogspot.com/

WitlessWonderer

  • Posts: 35
t4u is right.  For the last thing, you can just use a "Mouse on Self" event and use a block to tween the actor, like make it slightly bigger while the mouse is on the actor.

xplosion28

  • Posts: 275
I figured it out, the option you gave me still caused the same issues I was having.  The main issue with our methods is that they involved using the "When Updating" block which causes some issues with changing an animation.

For those people who need the answer, make a local attribute and set it equal to the global attribute (resource) that you are using by using the "When Updating" block.  Next make a "Attribute Number" block which states when an attribute becomes greater than a number.  This is where you can change the animation, then also include a if statement when the mouse hovers over the actor to change the animation to the hovered animation.  Finally make another "Attribute Number" block that will check when the attribute is less than a certain number and change the animation back to locked animation.