Pipe Game ... I have to trace water from source to destination
I have to make a pipe water game .
Like this one http://www.39games.com/arcade-games/the-pipe-game
But the problem is how do i detect when the water has successfully reached the destination.... if colliders then what logic to implement ? Should i make an object that goes through the pipes ?
Answer by kenazossou · Jun 13, 2017 at 09:24 AM
Hi Mawak!!! I'm trying to the same thing like you do (i.e simulate water flow through pipes) with shader but I get an error whith water direction. Sometime, the shader goes through a bad direction. Could you help me please? Thank you!!!!
Answer by _Game_Dev_Dude_ · Nov 18, 2015 at 01:49 PM
Well I can tell you how the game you linked works. It basically splits the entire scene into a 2D grid of squares. The water then travels linearly along this grid and changes direction based on which piece is in the square. So you would set a starting square and an ending square and then whenever you want you tell the water to "Go". it would then travel along this grid according to what pieces it comes into contact with and if it ever makes it to the ending square, it has reached its destination and you win!
This isn't the simplest thing ever but it is a good problem to work through. Hope this helps.
I have already done the water stuff and it is flowing fine....now the problem is how to detect if water is not in pipe....saying that water is out of pipe then it should destroy....how to detect it...that if water is not in the pipe
i have already done the water stuff but now i want to check whether water is in pipe....if not then destroy gameobject.....how to detect that?
How to do anything greatly depends on how you have made your game, which you are not telling.
If you had made it using a 2D grid where each grid cell has a connection node on some of its sides (as i probably would've done), then checking if "water is in pipe" is just checking if following the connection nodes leads to the end grid cell or to an unconnected node.
Thanks _Game_Dev_Dude. I agree it's not simple. Currrently, I'm trying to place 2 empty game objet on each pipe segment and calculate the water direction to follow; then generate an uniform rectilinear motionthrough each pipe segment. Though the problem persists. The motion direction changes but not yet in the right direction.