Realistic water simulation ! [NOT a game]

Jersmall

  • Posts: 30
you made jello! :)
LEARN PROFESSIONAL PHOTO EDITING, CLICK HERE

SadiQ

  • Posts: 1780
It resembles jello because it was affecting the framerate too much to let it behave more like water :(
In the bloons demo I have, if you press C you can see it behave more like water:
http://www.stencyl.com/game/play/20699
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

Max Finch

  • *
  • Posts: 2186
This is what I have. I used Floor so I don't get decimal points. With set Y I used the extra code to set it to the surface in the middle. It works near the last 32 or so pixels of my game going to the left < but anything beyond 32+ to the right > it stays at the very top of the scene..

vikingpotato

  • Posts: 854
Realistic water surface v3 (206) -  Array<UInt> should be Array<Int>
Realistic water surface v3 (206) -  Type parameters are invariant
Realistic water surface v3 (206) -  UInt should be Int
Realistic water surface v3 (206) -  For function argument 'colors'

Crashed for me :( I tried the latest private release as well as the stable release from 3 weeks ago.

SadiQ

  • Posts: 1780
Locate the line:
Code: [Select]
var colors:Array<UInt> = [_TopColor,_BottomColor]; And replace it with:
Code: [Select]
var colors:Array<Int> = [_TopColor,_BottomColor];
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

vikingpotato

  • Posts: 854
Thanks! That made it work.

The main issue now: In the demo the ripples occur when some physical object actually comes in contact with water. When i use this, the ripples occur whenever i tap on the screen, at the X of the Tap position.. How can i get this like in your demo ?

A minor issue: The height of the water works opposite as expected. I think the expected behaviour is that when the height is written '275' pixels, it should fill the bottom 275 pixels. Right now it fills everything but the top 275 pixels. This however doesn't even need a fix.

SadiQ

  • Posts: 1780
If you're talking about the bubbles demo all you have to do is get the X position of the object and add that to the code you have in the Click event (there's a Create wave at X of mouse...just change X of mouse with X of object).
For the second problem.. I havenĀ“t really thought about it, but it will be better (actually faster) to use the height in revers.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.