Creating better looking buttons

HbkmadnessHbkmadness Member, PRO Posts: 35

Hi,

I guess this question has been already asked but I didn't managed to find it.

I want when a button is touched to change its image ( to let's say one with lighter colours) but I don't really know how. I made a rule that says when it's touched change image but It works so fast it does not look like changing the image at all. I tought maybe I should add a timer for like 0.5 seconds but I don't think that's a cool solution so I'm asking if there is a better way.

Comments

  • bjandthekatzbjandthekatz Orlando, FlMember Posts: 1,375

    Could you interpolate its colors to the shade that you want when touched?

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    Hi @‌ The attached file should help you to learn the principle of toggling an image (well, it's one way out of a few).

    If you only want a colour change (with a Display Text behaviour over the coloured button, for instance) then replace the Change Image in both places with Change Attribute for self.Color.red/green/blue to the values you want.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • HbkmadnessHbkmadness Member, PRO Posts: 35

    Thanks for the project but that's not what I want. I guess I didn't explain it properly. I have an image for the normal button and the buton when it's touched.

    In many apps when you touch a button (like resume button or back to menu button) If you touched it and don't release you finger from it it would only change it's colour but It would not do anything else until you release your finger from it.

  • HbkmadnessHbkmadness Member, PRO Posts: 35

    While I was writing the last comment I ot an idea and It worked. I added a boolean which starts as false. When it's touched it only changes the boolean and the image so when it's released in the "Else" part I made a rule that says if this boolean is true do your job. I will try to explain it better in my next comment.

  • HbkmadnessHbkmadness Member, PRO Posts: 35
    edited March 2014

    So the simple explanation is like this:

    Rule :

     "If touched" then (-> change boolean to true;
    
                                        change image; )
        else (-> 
    
                     "if boolean is true" 
    
                           then-> (do whatever it does;)
    
                      else -> (do nothing;)
                 )
    

    This works for buttons that would be used only one time (like Resume Buttons or Back to menu buttons) but for ingame buttons I'm not sure it would work good I have to think about better way.

  • Mash_MobilityMash_Mobility Member Posts: 33

    How I do it is have it change image when pressed and have it do the function the button is supposed to do when its released. That way you can also hold down the button and it will change the image but not change it back, then when it gets released it does what its intended to do.

Sign In or Register to comment.