Flip coin animation

patapplepatapple Member Posts: 873
hi,

I'm trying to create an animation of a coin that flip continuously but i have no idea how to do that. I'm using illustrator and this is my coin. any help is appreciated!

http://img155.imageshack.us/img155/1638/coinq.png

Best Answers

  • LumpAppsLumpApps Posts: 2,878
    edited May 2012 Accepted Answer
    Out of my head because I am on my iPhone.

    You could use this illustration without the shadow as an actor.

    Then in the actor ad the following.

    Constrain self.size.height to (1+(sin(self.time%360*z)/2))*64

    z is a value that you can change to speed it up. So it can be any number depending on the speed you want. A higher number speeds up the rotation.

    In this case 64 is the height/width of your coin. If your height/width is 32px then use 32 for example.

    I hope there is no error in this. Otherwise let me know. (use my name with @ so I get a notice in your reply.
  • jckmcgrawjckmcgraw Posts: 647
    Accepted Answer
    @LudwigHeijden

    Would you mind explaining that formula for me? Looks like a great effect, but how the heck did you come up with that?

    Thanks,
    Jack McGraw
  • creativeappscreativeapps Posts: 1,770
    Accepted Answer
    @patapple email me on creativeweb25@gmail.com with details.
  • LumpAppsLumpApps Posts: 2,878
    Accepted Answer
    Yeah, I was on my iPhone so had to do it out of my had which isn't recommended at my age ;)
    Here is a new formula, this one should work.

    (1+sin( self.Time %360*700))*32


    700 is the speed and 32 the height.

    Here is an example project:
    http://dl.dropbox.com/u/21686348/flippingCoin.gameproj.zip

Answers

  • patapplepatapple Member Posts: 873
    @LudwigHeijden it doesn't work with your constrain attribute
  • patapplepatapple Member Posts: 873
    I change the height to the width because I need a vertical flip. Now there is a problem:
    the coin doesn't collide with the main character and I don't know why!

    thanks a lot
  • LumpAppsLumpApps Member Posts: 2,878
    Do you have a collide behavior or a rule that says.
    It might not work when using a rule because GS thinks the coin doesn't have any height. -sigh-

    In that case animating is a better option.
    I made a flippping disk animation a while back:
    http://dl.dropbox.com/u/21686348/coinflip.zip

    You may use this free. A credit in your game would be nice ;)

    I hope you are good at photoshop so you can paste your coin design into it.

    Good luck!
  • patapplepatapple Member Posts: 873
    OK! thanks! do you have the psd file? so it easier for me to edit.

    For sure a credit in my game will be to all the forum! ahahah
  • LumpAppsLumpApps Member Posts: 2,878
    I don't have a .psd but you can open these in Photoshop...
  • LumpAppsLumpApps Member Posts: 2,878
    @jckmcgraw
    I forgot to explain the formula.
    Its pretty easy. I don't know if you know anything about trigonometry but here is an explanation on that: http://en.wikipedia.org/wiki/Sine

    It's not so complicated. But I am not good at explaining. Perhaps someone else can??
  • jckmcgrawjckmcgraw Member Posts: 647
    @ludwigheijden

    I just learned basic trigonometry this year (8th grade geometry), and we haven't applied it to many situations.

    Thanks for the help though!
    Jack McGraw
  • LumpAppsLumpApps Member Posts: 2,878
    You are lucky. Trigonometry has a purpose for you. To me it was al abracadabra. I really didn't know what use it ever could have. :)
Sign In or Register to comment.