-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|676|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Snippet Home -> Collisions and Physics


 
Pakz
Created : 23 November 2016
Edited : 24 November 2016
Language : Monkey

Water in 2d map

See water flow/flood in a level.

lmb = poor water - rmb = place tile - mmb = erase tile/water.

Here a short video of it :
https://youtu.be/vtORT4-W91k

I have been spending time learning how to do water.

What happens in the code basically is. In the update a random position is chosen. If that position is water then see if you can move the drop down/left or right.
I added some code later to move water a little bit more sideways.

It took me a while to learn this. I first used a more complex way but found this simple way was a lot better.

It still probably needs more work.

Code for monkey 2


 

Comments


Saturday, 26 November 2016, 08:05
Pakz
I combined the water code with the mining map generator with ai. Still some work to be done but it is looking more interesting now.

https://youtu.be/Qqkc3IQ7C-Y
Saturday, 26 November 2016, 20:19
Stealth
That's really slick! *pun*