How do I spawn an entity in a blank space

Get help using Construct 2

Post » Sat Jul 11, 2015 6:49 pm

It finally works, kinda! In my first method I called the function, then checked the cellType and so on, kind of the same thing but longer and in a slight different order... A mess. It now generates the walls if I change *32 to cellSize but they don´t look like they are being placed correctly. EDIT: I just realized i´m over 500 rp, i´m uploading the damn .capx that would have made all of this way easier HERE: (requires litetween) https://www.dropbox.com/s/6t9zfd4dc4231 ... .capx?dl=0
Image
Image
Or else, they will spawn like these:
Image
B
9
S
3
Posts: 153
Reputation: 1,272

Post » Mon Jul 13, 2015 3:10 am

It seems that I require the "ParticlesWH" plugin from Scirra... However, I have no idea what that is...
B
74
S
31
G
26
Posts: 994
Reputation: 20,198

Post » Mon Jul 13, 2015 8:34 am

Oh really sorry, totally forgot about this one: (just a variant of the original particles) plugin-random-width-height-and-shrink-particles_t131459
B
9
S
3
Posts: 153
Reputation: 1,272

Post » Tue Jul 14, 2015 3:34 am

I finally got to take a look at it. It seems I botched the GetCellType function, had a second look at it and I had the value representing an empty and filled cell mixed up. Just adjust the value for "FakeWallSpot" to =1 and "Wall" to =3.
B
74
S
31
G
26
Posts: 994
Reputation: 20,198

Post » Tue Jul 14, 2015 10:54 am

It works as intented now! It picks all the possible spots but it also picks wall spots for some reason? You can see the well placed ones because they aren´t overlapping any wall.
Image
Here´s the .capx
https://www.dropbox.com/s/4qyo33rhfnsnq ... .capx?dl=0
Again, I can´t thank you enough for all the help!
B
9
S
3
Posts: 153
Reputation: 1,272

Post » Tue Jul 14, 2015 2:55 pm

Oops, I've added a condition in your previous capx and forgot to tell you about it. In event 20, be sure to restrict function calls to empty cells. So add a "Cave : Value at cave.CurX, cave.CurY = 1" before the "Pick CellTypePos..." and everything should be good.
B
74
S
31
G
26
Posts: 994
Reputation: 20,198

Post » Wed Jul 15, 2015 5:29 pm

Works 100%. Enormous thanks to you, @Magistross !
B
9
S
3
Posts: 153
Reputation: 1,272

Post » Wed Jul 15, 2015 5:54 pm

After a bit of testing I stumbled upon a rare occurrence of a "bug" that leads to some cells getting wrongly "typed" (a "Corner" getting labeled as "FakeWallSpot", for instance). The problem comes from the "cleaning" part where lone obstacle "cell" get removed. It's a bummer, but the only way to ensure that the bug never happen is to do the cell "typing" in a separate "For each XY" on the cleaned array, thus increasing the generation algorithm run time.
B
74
S
31
G
26
Posts: 994
Reputation: 20,198

Post » Wed Jul 15, 2015 6:12 pm

I can´t see exactly what part of the cleaning process you are talking about, but I know what you mean, I´ll see if I can fix it...
B
9
S
3
Posts: 153
Reputation: 1,272

Previous

Return to How do I....?

Who is online

Users browsing this forum: kainrazial and 19 guests