How can I make a actor shaking all the time or actor shake but only a few seconds?

dondan89dondan89 Member Posts: 150
edited January 2012 in Working with GS (Mac)
Hello,

How can I make a actor shaking all the time or actor shake but only a few seconds?

thank you

Comments

  • RDRD Member Posts: 88
    edited January 2012
    Yes, you can. Make a timer behavior, set it to "for 2 seconds". This will make our actor shake for 2 seconds.
    Now make another timer inside that one, set it to "every 0.1 seconds"
    Now make a behavior inside the timer: "Change X position to: (X.Position + (random(-2,2))

    The X position will then change to a position very close to itself very quickly. The change of the X attribute will be so subtle and fast it will seem as if it is vibrating, shivering or shaking. Doing the same for the Y position will make it shiver in both axis as well.
  • CloudsClouds Member Posts: 1,599
    edited January 2012
    @ dondan89

    Here you go dondan89

    A couple of different shakes, one on the left is the method RD mentioned - and the one on the right uses sine/cosine to shake stuff around, they both work and both can be run for as long or as briefly as you like by using a timer . . . . . one slight advantage the sine/cosine method has is that unlike randomly changing position by a small amount lots of time it will remain shaking in the same place, the randomly changing position by a small amount lots of time method will (if left to run long enough) end up somewhere different on the screen to where it stared . . . but that might actually be what you want !?

    I bet there are a hundred other ways to shake stuff around.

    Link: http://www.mediafire.com/?unm1oomgm145up3

    ...
  • dondan89dondan89 Member Posts: 150
    Hello,

    Thank You RD, Tynan, tshirtbooth for all the help

    thank you so much
  • CloudsClouds Member Posts: 1,599
    @Tshirtbooth

    Actually that's pretty cool, kinda' like RD's method but you keep returning the actors to their origin so you don't get the actor drifting over time, I quite like the quality, very cartoonish, might steal it for something I am doing !!
  • PimanPiman Member, PRO Posts: 165
    Guys, I tried to apply this to a plane just shot about to explode(shakes before it does), but the plane warps all around... is this because it has a -y motion? How can I make this work?
  • PimanPiman Member, PRO Posts: 165
    For anyone wondering how to do this for a moving actor with the actor warping: Just go with self.rotation of (9*sin( self.Time *5000))

    Though I am still wondering if it's possible to make it shake extra hard along with the x and y position manipulation without it warping to another point int he screen...
  • thelogobarthelogobar Member Posts: 93
    @tshirtbooth thats great, very handy!
Sign In or Register to comment.