How to make other buttons' animation change when the current

0 favourites
  • 3 posts
From the Asset Store
Pack Voxel art Pre-Render Containing Voxel Animation + Source (3cp) + Scene Voxel + 2 Bonus
  • Hi,

    I am trying to add animations on my buttons when touched to set them as "OT" animation, when untouched set to "default", everything is fine but the problem is when I leave the first button touched and go to touch the second one, the first button still animated, I would like to make other buttons to be the "default" animation when I touched anyone button, who have ideas, please help, thanks

    File: https://www.dropbox.com/s/w5pkfskdlbg2reb/2.capx?dl=0

    thanks

  • The problem is you are never setting the "close" instance variable to false once it is set true by touching the button. So when you touch the second or third buttons, the other buttons still have "close" set to true, so they still play the OT animation.

    I got it to work the way you wanted by adding a sub event under the Touch event to Pick All cityButton, then a sub event under that to select cityButtons playing the OT animation, then an action to set "close" to false. (then their animation gets set to "Default" by the code below.

    With that change the code works fine, but you should be aware that every single tick it has to select all the buttons with close true and set their animation to OT, then select all the buttons with close false and set their animation to Default. That is a lot of extra work, 60 times a second with no visible difference to the user. With only a few buttons, you wont have a problem, but as the complexity of your game grows you may want to eliminate repetitive events that don't really do anything useful, and structure it in a way so that it only changes the animations once in response to user input.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • AllanR thanks, problem solved like you said, really thanks

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)