Setting object movement?

Get help using Construct 2

Post » Sun Mar 15, 2015 7:55 pm

How do i make and object move randomly around the screen?
The object will constantly move around the screen until the game ends

The object isn't to jump from one place to another, it is meant to move like a bullet but constantly in random directions..

Thank you
B
8
S
2
Posts: 146
Reputation: 1,132

Post » Sun Mar 15, 2015 9:19 pm

every random(3) seconds set bulletobject.angle to random(0, 360)
Frosty Elk AB
www.frostyelk.se
Have no fear, We come in peace!
B
13
S
3
G
1
Posts: 106
Reputation: 1,169

Post » Mon Mar 16, 2015 12:37 am

Thank you :)

How do i keep it within the bounds of the screen?

the screen size is 1280 x 720
B
8
S
2
Posts: 146
Reputation: 1,132

Post » Mon Mar 16, 2015 1:16 am

You can compare an objects X value using - compare X

Maybe if the X is less than 0 or greater than 1280 you can change the condition to bring it back onto the right side. So instead of 360 it could be 180 etc.

Or you could have some invisible border objects that once overlapped do the same thing. Heaps of possibilities really.
ImageImage
B
112
S
23
G
7
Posts: 1,064
Reputation: 12,787

Post » Mon Mar 16, 2015 1:18 am

could you possibly explain how i would go about doing this? sorry to be so blonde haha
B
8
S
2
Posts: 146
Reputation: 1,132

Post » Mon Mar 16, 2015 1:21 am

No worries zik, we all start somewhere.

ill make a quick example with bullet behaviour to show you. Just give me a couple of minutes.
ImageImage
B
112
S
23
G
7
Posts: 1,064
Reputation: 12,787

Post » Mon Mar 16, 2015 1:41 am

Here is how you do it with compare X, Compare Y
You do not have the required permissions to view the files attached to this post.
ImageImage
B
112
S
23
G
7
Posts: 1,064
Reputation: 12,787

Post » Mon Mar 16, 2015 1:46 am

Here is an alternative using border objects.

Remember this is just 2 simple ways, you could experiment with other conditions and come up with the best way to suit any particular project.
You do not have the required permissions to view the files attached to this post.
ImageImage
B
112
S
23
G
7
Posts: 1,064
Reputation: 12,787

Post » Mon Mar 16, 2015 11:13 am

Another way to keep it inside the boundaries is to use the Behaviour "Bound to layout" on the object.
Frosty Elk AB
www.frostyelk.se
Have no fear, We come in peace!
B
13
S
3
G
1
Posts: 106
Reputation: 1,169

Post » Tue Mar 17, 2015 1:08 am

Hey sorry for the late response, thanks so much guys for the help. This is an awesome community :D
B
8
S
2
Posts: 146
Reputation: 1,132

Next

Return to How do I....?

Who is online

Users browsing this forum: apalm1341, blissfulwizard, Malhog and 17 guests