oscillation question

Get help using Construct 2

Post » Sun Oct 09, 2011 8:12 am

how do i get an object to oscillate back and forth (i.e. if i have an enemy on a platform, how do i get it to go back and forth from side to side)?

any suggestions...
B
16
S
2
G
1
Posts: 43
Reputation: 1,473

Post » Sun Oct 09, 2011 8:58 am

You could try to use the "Move the MovingPlatform object according to a formula" that can be found in your Construct 2 examples folder. I believe it is the Platform 6 example.
B
50
S
11
G
8
Posts: 479
Reputation: 9,911

Post » Sun Oct 09, 2011 8:59 am

You can have it keep moving until it encounters an obstacle, in which case it turns around. You can use solid (other enemies, walls etc.) or invisible sprites (in case of hanging platforms so they don't fall down).
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Mon Oct 10, 2011 8:27 am

thanx

@mipey your suggestion was functional enough for me

@wink i'll play around with the formula and see what i come up with
B
16
S
2
G
1
Posts: 43
Reputation: 1,473

Post » Mon Oct 10, 2011 10:46 am

to make it move nice and smoothly, apply this formula to the X value every tick to move it side to side:

(distance from left edge + modifier * sin(time*modifier))

Play around with the modifier values to get it to move faster and / or further.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400


Return to How do I....?

Who is online

Users browsing this forum: Colludium and 29 guests