GameSalad

Getting actor to "wiggle"

jakemiller13jakemiller13 Posts: 2Member, BASIC

Hi all,

Pulling my hair out here as I've been trying to get this to work for days. How can I get an actor to wiggle back and forth?

What I'm trying to have happen is a fish move across the screen in a wave pattern. My thought was to give it forward motion as one behavior, and then have conditionals that trigger it to Rotate to Angles back and forth when it reaches certain extremes (+/- 45 degrees). No matter what conditionals I give it, I can't get it to rotate back and forth. I've tried many combinations of Rotate to Angle, Rotate, Loop (not supposed to work with Rotate anyways).

Any ideas? Thank you!

Comments

  • SocksSocks London, UK.Posts: 12,820Member
    edited March 22

    "What I'm trying to have happen is a fish move across the screen in a wave pattern"

    Constrain X position to A*sin(game.time*B )+C

    C is the centre point of the movement, A is the extent of the movement in pixels, B is a multiplier to speed up or slow down the movement.

    You can also use a sine wave to rotate an actor.

    Constrain Rotation to A*sin(game.time*B )

    A is the extent of the rotation in degrees from 0°, B is a multiplier to speed up or slow down the rotation.

  • jakemiller13jakemiller13 Posts: 2Member, BASIC

    Oh my god, of course! I didn't think about using an actual sine function. Thank you!

Sign In or Register to comment.