# Getting actor to "wiggle"

Member, BASIC Posts: 2

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!

• London, UK.Member Posts: 12,822
edited March 2018

"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.

• Member, BASIC Posts: 2

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

• Member, PRO Posts: 458
edited June 2018

God is capitalized. Also please don't use His name in vain. Thanks.

• Member Posts: 461

• London, UK.Member Posts: 12,822
edited June 2018

..

• Member, PRO Posts: 1,067

Hmmm...

• Member Posts: 461

@AllMyGSHomies I didn't mean to offend anybody. Just trying to lighten the mood.

I used to take hard life stuff (like religion) very seriously. I've learned there's value in being able to poke fun at myself and just relax a bit.

• Member, PRO Posts: 188

@Twayne2 said:
God is capitalized. Also please don't use His name in vain. Thanks.

Lol, sorry chump but I will use "his" name in any manner I choose to. You're welcome

• Member, PRO Posts: 458

Sorry, it was not my place to bring it up. Please forgive me. I wish you luck and hope you turn to the Lord. Please close this thread.

• Member, PRO Posts: 188

@Twayne2 said:
Sorry, it was not my place to bring it up. Please forgive me. I wish you luck and hope you turn to the Lord. Please close this thread.

You're right, it wasn't your place at all. Your comment was unwarranted, off-topic, and served no positive purpose.
I'll consider granting you my forgiveness, only AFTER you stop 'hoping' that I 'turn to' your deity.
Frankly, you owe an apology to @jakemiller13 for hijacking his post, and you have no right to ask for this thread to be closed.

• Encounter Bay, South AustraliaMember Posts: 1,390

@jakemiller13 You've just learnt how easy it is to get in trouble around here... and having fun is not permitted, but we do it anyway. >:)