Create objects on a sine wave.

Get help using Construct 2

Post » Thu Dec 22, 2011 12:21 pm

Hi, Im new to construct(LOVING IT) And have started to understand it really well!! One quick question if you wouldn't mind helping a noob out..

Could someone tell me how to make a object follow a sine wave and spawn a object from its position every x seconds..

I know how to spawn every x seconds,

And I know a very rough way of making the wave(Using MoveTo plugin) But i want a really nice smooth wave, Which can be adjusted at runtime.

Thanks for your help!       
B
6
S
1
G
1
Posts: 42
Reputation: 810

Post » Thu Dec 22, 2011 12:31 pm

Could the behavior Sine of help here ?

Else, Pode is supposed to release a spline movement behavior soon. Be sure to check the plugins section back from time to time.

And finaly you can always control your object through events, setting its movement as you like each tick. (Maths involved). How events work.

Hope it helps.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Thu Dec 22, 2011 12:49 pm

@Kyatric,

I tried to use the sine behavior, But I dont really understand it..

and as for doing through events, What do you suggest somthing like:

global var targetY1
global var targetY2

System: Every tick
   Object:Set y Position - lerp(self.y, targetY1,0.8)

Something like that? But then how about once it hits its target position, How do you set it to target the next(targetY2) ?? and what about smoothness. Any ideas?
B
6
S
1
G
1
Posts: 42
Reputation: 810

Post » Thu Dec 22, 2011 2:25 pm

Sine behaviour is the way to go. Set movement to vertical or horizontal and adjust the other properties. It's pretty simple, have you looked at the examples?
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Thu Dec 22, 2011 2:31 pm

If you like to take look at my "sine solution", you may look in my CAPX..

Here is the LINK
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Fri Dec 23, 2011 9:17 pm

@Weishup, Thanks for the capx, But it all seemed a little to complex to me.

@squiddster, Yeah eventually i understood the sine behavior, I was just being dumb to be honest :)
B
6
S
1
G
1
Posts: 42
Reputation: 810


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider] and 13 guests