February 9, 2015 at 9:19 am #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!!February 11, 2015 at 8:12 am #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.February 12, 2015 at 9:35 am #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 🙂February 12, 2015 at 1:52 pm #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.susa38ParticipantFebruary 12, 2015 at 1:53 pm #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 workFebruary 12, 2015 at 3:45 pm #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.susa38ParticipantFebruary 13, 2015 at 2:14 am #83461
I use this idea of the variable to make different things.
– 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
In the puzzle game and the memory game tutorial Alex explain the use variables (these are advanced tutorials)
Nice to help because I learn all in this forumFebruary 15, 2015 at 12:55 pm #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!
You must be logged in to reply to this topic.