Home / Topic / Play/Pause Sprites

Play/Pause Sprites

Viewing 9 posts - 1 through 9 (of 9 total)
  • Tamarwoo
    Participant
    #83450

    I’m trying to make a button that will open a door on the first tap and close it on the second. I have a sprite sheet of the opening door. I’ve told the animation to play backwards when it finishes and set a timer to pause when it’s wide open. It would make sense for the next “play” command to resume the animation from where it was paused, but it just plays it again from the beginning. Is this something you would consider fixing? If not, can you suggest a different solution? Thank you!!

    Jorge
    Participant
    #83452

    I have never tried to achieve what you wish with sprites.
    Did you try to create two buttons, being the second one just a copy of the first one. Save the second one as the first one on Page Properties.
    Use button 1 to open the door and button 2 to close the door. Button one should be hidden (Hide Action) after being triggered and button one Shown immediately after. Play with Pause Sprite and Timers. As a last chance ask button two to open and close the door (reverse at the end) and try to hide the opening part of it (Linear Animation, alpha?) in such a way that only makes visible the closing part of the animation.
    These are the things I would try.
    I would also would be happier if animations could be paused at the end and have the ability to resume them by reversing the animation, but do not think that this is possible in the current version of Kwik. If anybody has an idea, please let us know.

    Tamarwoo
    Participant
    #83455

    Thanks for answering Jorge! The only problem I have with what you suggest is that when the door is open and you tap for it to close, nothing will happen while the hidden animation is opening the door again and then suddenly the door will close and it will seem like something is wrong because it didn’t happen right after the tap. Unless I misunderstood? Thanx anyway 🙂

    Jorge
    Participant
    #83456

    I think you got it right.There must be that undesirable time lag.
    And if you trigger the initial part of the animation (Timer), pause it just when it should reverse and then the button triggers the rest of the animation when tapped? Hope you will succeed.

    susa38
    Participant
    #83457

    I think some possibilities.
    Sorry for my english and i say to you with memory (perhaps some words or the name in kwik is not the same)

    First of all if you are using texture packer you can make one spritte opening and closeing and the spritte have the same kb (if it’s the same movement to close and open) because texture packer save only the similar frames

    Then in kwik you can make different animation in the spriteset panel.
    for example the sprite have different animation each one with one name
    image 1 – closed
    image 1 to -4 opening
    image 4 – opened
    image 4 to 7 – closing

    then you have to create one variable
    for example x=1

    And two actions
    -one action to open the door and when finish change the variable to 0
    this is in action panel play sprite opening and set variable = 0
    – one action to close the door and when finish change the variable to 1
    this is in action panel play sprite closing and set variable = 1

    And the button
    in the action panel for the button you have to click on the left buttons
    if x=1 play action opening
    and if x=0 play action closing

    Sorry if I do not use the exact words for the thinks in kwik panel.
    but this is the idea.
    I make it sometimes and it work

    Jorge
    Participant
    #83458

    Thanks. Excellent and clear solution.
    Your English is more than very good.
    I understand that you have created the full closed/opening/opened/closing/closed cycle.The variable idea helps a lot.
    It makes sense and I will keep this solution in my Favorites for future (maybe near future).
    Nice to char with you and hope have helped anything. Many thanks for sharing and keep going.

    susa38
    Participant
    #83461

    No problem.
    I use this idea of the variable to make different things.
    For example,
    – one menu that is showing only the right side and the user can drag it to see all the menu
    – to make that one object or draw can make differents actions
    – play a sound or other in different situation

    I do not remember where i get the solution. I think is good to try using the variables in a simple scene to understand the way but…

    Is good to make something more complex also.
    This is an example in intermediate tutorial
    http://kwiksher.com/tutorials_kwik/video-tutorial-creating-a-quiz/

    In the puzzle game and the memory game tutorial Alex explain the use variables (these are advanced tutorials)
    http://kwiksher.com/tutorials_kwik/creating-a-game-puzzle/
    http://kwiksher.com/tutorials_kwik/creating-a-memory-game/

    Nice to help because I learn all in this forum

    Tamarwoo
    Participant
    #83471

    Thanks for all the ideas! I don’t really know how to work with variables, but using one sprite sheet from texture packer for the opening and closing was a great idea! I did that. When I connected the sprite sheet to kwik I broke it into 2 sequences- opening and closing. Then I made 2 actions for these 2 sequences and a button with the wonderful option “Play random” which plays the first sequence on the first tap and the second on the second. This seems like a good solution which I will continue using. this has been very helpful, Thanx so much!

    Jorge
    Participant
    #83472

    Great!I am very pleased to hear that. I also know the feeling of achieving something with Kwik. This is why I like it more and more.

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.

Privacy Preference Center

Strictly Necessary

these coolies are for WP-SpamShield, gdpr-wp, woocommerce, paypal

PHPSESSID, SJECT16, JCS_INENREF, JCS_INENTIM, gdpr, woocommerce_cart_hash, woocommerce_items_in_cart, woocommerce_recently_viewed, wordpress_, wordpress_logged_in_, wordpress_sec_, wordpress_test_cookie, wp_woocommerce_session_, AKDC, akavpau_ppsd

Functionality

WordPress cookie created when auto-saving a post in the editor.

wp-saving-post, wp-settings-, wp-settings-time-

Performance

google analytic

__utma,__utmb,__utmc,__utmz,_ga,_gid,_gat

Advertising