Random motion of an object. Help.

Discussion and feedback on Construct 2

Post » Sat Nov 16, 2013 6:34 pm

I would like to add the option, That an object will move by itself, without anyone pressing any buttons, in various directions, right, left, up and down the screen.

Is there any plugin That Allows this?

Thank you very much.
B
10
S
2
Posts: 205
Reputation: 1,619

Post » Sat Nov 16, 2013 7:05 pm

This is precisely what the sine behavior is for..well, that and a lot of other things that require smooth variation. You can add multiple sine behaviors to an object to have it move horizontally, vertically, scale, transparency, rotation, etc.
B
9
S
3
G
4
Posts: 80
Reputation: 3,273

Post » Sun Nov 17, 2013 7:46 am

I think you can also do this with bullet behavior as bullet behavior also support directions. I think you can also the random direction movement with time , like every Random time there will be a Random direction picked by your object. Not check , it is just an idea you have to gave it a try. Hope that helps .
B
96
S
20
G
15
Posts: 198
Reputation: 14,571

Post » Sun Nov 17, 2013 8:11 am

What I want to do, Is that an object, for example (an enemy) The only move to the right, left, up, or down, Simultaneously, anyone without press any key. And every time the enemy, is directed right, play an animation in the sprite of the enemy walking to the right, and do the same, When you go up, down or to the left.


Took about 3 hours and not gotten anything yet .. Any help?
B
10
S
2
Posts: 205
Reputation: 1,619

Post » Sun Nov 17, 2013 1:47 pm

Sine behavior as someone already mentioned.

Save the current x and y of your object into an instance variable and before that compare if those instance variables are smaller or larger than the current x and y and then change the animation accordingly.
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 788
Reputation: 3,788


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 11 guests