How to slide a button and make a hammer swing?

wayback_gamerwayback_gamer USMember, PRO Posts: 124

I have a large hammer and I want to make it swing and smack down then come back to the upright position. Then image starts at X 38 Y 147 Rotation 60. This is the upright position. To make the image appear to swing like a hammer I have to rotate the image to 0.0 and Move to X 59 Y 127. I have a circular button that users will drag from right to left. As the image is dragged I would like to manipulate the above numbers. Then as the image comes back obviously reverse it. I only want my button to move 140 pixels and its 70 pixels wide and starts at X 175. I've created 3 real attributes one for each of the variables and constrained them to the correlating attributes of the image. Now I just need to increase the X and decrease the Y and Rotation of these attributes as the button is dragged left to swing the hammer. From there I can reverse it and make it go back.

Best Answers

  • SocksSocks London, UK.Posts: 12,822
    Accepted Answer

    @wayback_gamer said:
    I have a large hammer and I want to make it swing and smack down then come back to the upright position. Then image starts at X 38 Y 147 Rotation 60. This is the upright position. To make the image appear to swing like a hammer I have to rotate the image to 0.0 and Move to X 59 Y 127. I have a circular button that users will drag from right to left. As the image is dragged I would like to manipulate the above numbers. Then as the image comes back obviously reverse it. I only want my button to move 140 pixels and its 70 pixels wide and starts at X 175. I've created 3 real attributes one for each of the variables and constrained them to the correlating attributes of the image. Now I just need to increase the X and decrease the Y and Rotation of these attributes as the button is dragged left to swing the hammer. From there I can reverse it and make it go back.

    Didn't really understand most of that ! :smile:

    You basically want a hammer type action controlled by a slider ? I'll make you a quick demo . . . .

  • SocksSocks London, UK.Posts: 12,822
    Accepted Answer

    Here you go, drag the red box left and right to hammer stuff, the values are probably nothing like you want or need but it should give you a basic idea and I'm sure you can adjust stuff to suit your own needs.

    Link: https://www.mediafire.com/?ocnknzqz3ffxoan

  • SocksSocks London, UK.Posts: 12,822
    Accepted Answer

    Here's a kind of spring loaded one, drag the red box to the left then release . . .

    Link: https://www.mediafire.com/?h39nci138q9rx73

Answers

Sign In or Register to comment.