Wave movement up and down
Boorje75
Member Posts: 13
I'm trying to create a wave movement (up and down) for my actor and at the same time its moving across the screen to the right. Any suggestions?
Comments
Move the actor across the screen to the right however you like, you can use Move, Move To, Interpolate, Accelerate . . . etc.
Then constrain the actor's Y position to: AAA * sin(self.time * BBB)+CCC
AAA = height of the wave.
BBB = pitch of the wave.
CCC = vertical centre point of the wave.
So for example, in a landscape iPad sized project try 200 * sin(self.time * 100)+384
The actor I want a wave motion on spawns randomly between 500 and 900, do I have to take that i consideration when setting my values?
You need to create an attribute on the actor to track its Y position. make a YActor attribute, and have it Changed to Self.positionY as one of the first behaviors. Then replace the CCC in the other formula with YActor or whatever you call it. That way, you can drop an actor anywhere and it will center its wave motion on that spot.
Hi @Boorje75
i'm sure @Socks won't mind me answering: you mean between 500 and 900 being the height of the wave?
If so, try this: make an integer attribute, let's call it WaveHeight. I'll assume you'll trigger a new spawn every time with a boolean (Let's Call that SpawnGo)
Edit: typing while @Tosanu was typing...
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Thanks for the help! I figured it out