How do I make random movements.

Get help using Construct 2

Post » Mon Oct 26, 2015 10:48 am

What is the best way to go about if i want to make random movements. Kind of like an insect (fireflies) moving around or a particle froating around in a bit turbulent air? I need a bit or randomised speed and direction but kind of smooth. no steep angle changes in direction.
Follow my progress on Twitter
or in this thread Archer Devlog
B
35
S
15
G
17
Posts: 944
Reputation: 12,210

Post » Mon Oct 26, 2015 1:04 pm

Would something like sine work?
Eat ALL THE BACON!
B
45
S
17
G
3
Posts: 290
Reputation: 4,993

Post » Mon Oct 26, 2015 1:26 pm

Something like this?

Random fly-movement

It's just these events:

Image

If you want it less drastic, you could always just set an instance variable instead of changing the angle directly and rotate 1 degrees towards it if the current angle is not between -1 and +1 of the new angle..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Oct 26, 2015 2:16 pm

LittleStain wrote:Something like this?

Random fly-movement

It's just these events:

Image

If you want it less drastic, you could always just set an instance variable instead of changing the angle directly and rotate 1 degrees towards it if the current angle is not between -1 and +1 of the new angle..


Thanks. Maybe some anglelerp here would help smooth out the direction changes. I don't really want any sharp changes in direction, more softer curves. Will try it out when i get back home.
Follow my progress on Twitter
or in this thread Archer Devlog
B
35
S
15
G
17
Posts: 944
Reputation: 12,210


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 4 guests