How do I Create procedural Water

0 favourites
  • 6 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • 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.

  • 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.

  • I'm using Tilemaps is there a way to check it with those.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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:

  • Thanks, R0J0hound I will try it

  • I got it to work on tilemap, thank you guys for your help really it awesome.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)