Random movement

Get help using Construct 2

Post » Sat May 19, 2012 1:17 pm

how can I do that an object has random movement?
For example, that one object moves horizontally, other vertically...
And how can I do that the object bounce diagonally when collision with the limits of the room?
(I'm spanish, sorry if I write bad)

Thanks for your answers
B
4
Posts: 10
Reputation: 523

Post » Sat May 19, 2012 1:49 pm

It would be nice if you were a little more specific. Could you give us some images to show what you want?
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Sat May 19, 2012 2:03 pm

Yes:
http://dl.dropbox.com/u/55341396/example.png
(I don't know if I write correctly in the paint because I only know English to study at the institute)
B
4
Posts: 10
Reputation: 523

Post » Sat May 19, 2012 2:03 pm

Do you want every instance of the same object to move differently or that every object has its own movement?

EDIT:
So if you want the objects to maintain their speed while "bouncing" you just need to edit their Y movement when colliding with top and bottom boundaries and their X movement if they collide with left and right boundaries.

So lets say one object is moving 100,-100 pixels per second. When it collides with the top boundary just make it move at 100,100.KFC2012-05-19 14:13:49
B
33
S
12
G
7
Posts: 227
Reputation: 7,582

Post » Sat May 19, 2012 2:25 pm

I want every instance of the same object move differently.
The problem is that I am totally new to the program and do not know just how to do things.
What actions / events I have to put in the object? I do not know or do the random motion when the game starts, no bounce ...
B
4
Posts: 10
Reputation: 523

Post » Sat May 19, 2012 3:27 pm

Why not give them the bullet behavior, then enable bouncing off solids?
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Sat May 19, 2012 3:46 pm

Thanks for your answer. I managed to make the object rebound, but I do not know how to bounce diagonally. What event or action should I set?

And how do I make an object to collide with another one appears randomly in the room?

Sorry for the inconvenience of my little knowledge
B
4
Posts: 10
Reputation: 523

Post » Sat May 19, 2012 3:58 pm

http://dl.dropbox.com/u/14492504/construct2examples/horvertbox_randombounceball.capx
Here is and example I did. Dont know if I understod you correctly but it show you how to set horizontal or vertical movement on a sprite with bullet behaviour. And the how to set a random direction at the different direction when a bullet behaviour collide with the layout border. You can of course change these values to have them at a specific angle.
B
30
S
9
G
5
Posts: 7
Reputation: 6,009

Post » Sat May 19, 2012 4:28 pm

Oh, is great!! thank you very much!!

Also thanks to others for trying to help me :)
B
4
Posts: 10
Reputation: 523


Return to How do I....?

Who is online

Users browsing this forum: Artpunk, gregorysforster, onzephyr, Yahoo [Bot] and 1 guest