How do I Create procedural Water

Get help using Construct 2

Post » Sat Nov 07, 2015 7:41 pm

Hello, my name is Carlos I have a procedurally generated world and when it bitwise completes I would like to fill some areas with water but I can't seem to be able to do this I would really appreciate the help of anyone who is willing to help and Thank you. I just need help in Tilemap Water that flows and stops at solids.
Image
B
21
S
3
G
1
Posts: 38
Reputation: 1,590

Post » Sun Nov 08, 2015 12:52 am

For the purpose of this example I'm going to assume your world is built up of blocks, like terraria. Im sure you could adapt this if it isn't, but anyways.

What I would do is something along the lines of, When a "block" of water is created, spawn "check" blocks to the down, left, and right of it. If these check blocks collide with a solid block, say "stone", then delete the check block, and do nothing else. This way, your "check" block spawns to the right of the water source, checks if theres a solid wall to the right of it, if there is, then no water flows to that block. If there isn't, however, a block at this spot, delete the check block and replace it with a water block.

It wouldn't be this simple, you'd have to have it check if theres a solid underneath it, otherwise it would flow off for infinity at the same height, stuff like that, but hopefully you get the general idea of what I mean. I'm sure theres a much easier way of doing this with arrays, but I personally like to avoid arrays.
B
5
S
1
Posts: 54
Reputation: 508

Post » Sun Nov 08, 2015 1:40 am

I'm using Tilemaps is there a way to check it with those.
Image
B
21
S
3
G
1
Posts: 38
Reputation: 1,590

Post » Sun Nov 08, 2015 2:12 am

You could use two for loops to check each tile in the tilemap. Then just check the tiles around it if it's a water tile.

There's an old example of grid based water here:
what-is-the-attributes-counterpart-in-construct-2_p715663?#p715663
B
94
S
33
G
114
Posts: 5,359
Reputation: 73,779

Post » Sun Nov 08, 2015 2:22 am

Thanks, R0J0hound I will try it
Image
B
21
S
3
G
1
Posts: 38
Reputation: 1,590

Post » Sun Nov 08, 2015 2:38 am

I got it to work on tilemap, thank you guys for your help really it awesome.
Image
B
21
S
3
G
1
Posts: 38
Reputation: 1,590


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider] and 12 guests