random create actor within distance

Get help using Construct 2

Post » Mon Apr 08, 2013 12:10 am

Hi, im creating a object inside the layout boundaries and using a random generator. Every 0 to 3 seconds i create one of these sprites. actually some sprites are created at the same spot that others.

but i want that each object created do not be created over another existing sprite. there's a way to guess where the other actors are in the moment of creation and set some distance from the already created actors?

tks
B
15
S
3
G
2
Posts: 20
Reputation: 1,626

Post » Mon Apr 08, 2013 7:11 am

[QUOTE=saulochina] Hi, im creating a object inside the layout boundaries and using a random generator. Every 0 to 3 seconds i create one of these sprites. actually some sprites are created at the same spot that others.

but i want that each object created do not be created over another existing sprite. there's a way to guess where the other actors are in the moment of creation and set some distance from the already created actors?

tks[/QUOTE]

Here is an example that does something similar, none of the sprites at the start are allowed to spawn on top of each other.

Evil sprites demo
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Thu Apr 11, 2013 1:56 pm

Hi Vee, tks for the help. I used your example but without success. i still dont understand what is that "pick instance 0" and i some of my objects are still overlapping the others. here is what i have done (see the pic) all of my actors are randomly created

https://www.dropbox.com/s/53brakrhin4wf3c/overlaping.jpgsaulochina2013-04-11 13:57:29
B
15
S
3
G
2
Posts: 20
Reputation: 1,626

Post » Thu Apr 11, 2013 11:02 pm

Pick instance 0 just refers to the first instance of that particular sprit object that was created. So lets say you create 3 actors on the screen. Each actor is referenced as an instance. So you would have that particular sprite object at the instances of 0,1,2 and picking the 0 instance is like picking the first of that same sprite object that was created. Well, I believe that's what it isretrodude2013-07-03 22:18:28
B
18
S
4
G
3
Posts: 436
Reputation: 4,801

Post » Thu Apr 11, 2013 11:04 pm

Whenever an sprite object is created it starts at an instance of 0 instead of 1, but basically what that example is saying, is that if cupcake is created, and if its overlapping another cupcake, then pick the 1st instance of cupcake (so the first one created) and change its position to a random spot. retrodude2013-07-03 22:18:37
B
18
S
4
G
3
Posts: 436
Reputation: 4,801

Post » Mon Apr 15, 2013 2:32 pm

tks for the explanation retrodude, now i understand a little more about this. and finally i had achieved what i wanted. ;)
B
15
S
3
G
2
Posts: 20
Reputation: 1,626

Post » Wed Jul 03, 2013 12:53 pm

My problem is, when my second people touch in the frist, the second stop and the next, stop too, but when the row is full, the last people go out (is a overlapping>foward to -30), but the row stop to walk...


If, the people overlapping, the people distroy...



Give me a dropbox acount(your login) and I will send a .capx

My e-mail is pablolink23@gmail.com ( in dropbox)
B
10
S
2
G
2
Posts: 81
Reputation: 1,757


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 16 guests