how to make 2D water generation like in minecraft? 2D platformer

0 favourites
  • 5 posts
From the Asset Store
10 Retro songs ideal for platformers or farming games
  • I have a 2D project with world generation on an array, I figured out how to generate the top layer (grass) and bottom layer (dirt) and I want to add water generation.. but I don’t know how to implement it... I need water to appear with sand, that is, to begin with, one layer of sand is generated and on top of the sand there is water, and after that there is earth again... I hope I was able to explain.

    https://drive.google.com/file/d/1TxkYZGoSq_gLlgBeZxO0mgISQOI4HyZK/view?usp=sharing

  • I have a 2D project with world generation on an array, I figured out how to generate the top layer (grass) and bottom layer (dirt) and I want to add water generation.. but I don’t know how to implement it... I need water to appear with sand, that is, to begin with, one layer of sand is generated and on top of the sand there is water, and after that there is earth again... I hope I was able to explain.

    https://drive.google.com/file/d/1TxkYZGoSq_gLlgBeZxO0mgISQOI4HyZK/view?usp=sharing

    I can't open your prj because I don't have seed plugin,

    But you could just randomly spawn water at x, y-1 or more. This will randomly produce a cube above sand. Make sure that you only create tiles if array cell is 0 or less.

    but to have a lot of water,

    waterSpawn = 0

    set waterspawn to choose(0,1)

    for 0 to waterSpawn

    loopindex = 0 create tile sand at xy

    loopindex = 1 create water tile at x, y-1

    Hoe you can figure out other things from this example. you can add more loops.

    If you want water pool you probably need to first make a random choice, then repeat maxWater times for y - loopindex("maxwater")

    For sand above same logic, just more coding.

  • thanks 😊

  • >

    I have a 2D project with world generation on an array, I figured out how to generate the top layer (grass) and bottom layer (dirt) and I want to add water generation.. but I don’t know how to implement it... I need water to appear with sand, that is, to begin with, one layer of sand is generated and on top of the sand there is water, and after that there is earth again... I hope I was able to explain.

    >

    > https://drive.google.com/file/d/1TxkYZGoSq_gLlgBeZxO0mgISQOI4HyZK/view?usp=sharing

    I can't open your prj because I don't have seed plugin,

    But you could just randomly spawn water at x, y-1 or more. This will randomly produce a cube above sand. Make sure that you only create tiles if array cell is 0 or less.

    but to have a lot of water,

    waterSpawn = 0

    set waterspawn to choose(0,1)

    for 0 to waterSpawn

    loopindex = 0 create tile sand at xy

    loopindex = 1 create water tile at x, y-1

    Hoe you can figure out other things from this example. you can add more loops.

    If you want water pool you probably need to first make a random choice, then repeat maxWater times for y - loopindex("maxwater")

    For sand above same logic, just more coding.

    How can you make ore generation on the rise?) As I understand it, I need to check the height ( Y ) in the array and create an ore sprite in place of the stone, but when I implement it, nothing happens...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > >

    I have a 2D project with world generation on an array, I figured out how to generate the top layer (grass) and bottom layer (dirt) and I want to add water generation.. but I don’t know how to implement it... I need water to appear with sand, that is, to begin with, one layer of sand is generated and on top of the sand there is water, and after that there is earth again... I hope I was able to explain.

    > >

    > > https://drive.google.com/file/d/1TxkYZGoSq_gLlgBeZxO0mgISQOI4HyZK/view?usp=sharing

    >

    > I can't open your prj because I don't have seed plugin,

    > But you could just randomly spawn water at x, y-1 or more. This will randomly produce a cube above sand. Make sure that you only create tiles if array cell is 0 or less.

    > but to have a lot of water,

    >

    >

    > waterSpawn = 0

    > set waterspawn to choose(0,1)

    > for 0 to waterSpawn

    > loopindex = 0 create tile sand at xy

    > loopindex = 1 create water tile at x, y-1

    >

    > Hoe you can figure out other things from this example. you can add more loops.

    > If you want water pool you probably need to first make a random choice, then repeat maxWater times for y - loopindex("maxwater")

    >

    > For sand above same logic, just more coding.

    How can you make ore generation on the rise?) As I understand it, I need to check the height ( Y ) in the array and create an ore sprite in place of the stone, but when I implement it, nothing happens...

    I'm not sure what you mean? It does also depends on your code and weater u are using sprites or tilemap ( you should be using tilemaps), so it's hard to say just like that.

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