Simple water

0 favourites
  • 6 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • I want to make some sort of water. Not the one splashing, but the one that objects can swim on. I tried by making two objects with different physics densities, but what I've found is that the floating object only dips in a little with one edge into the water. How could I do it without thousands of recource-demanding physics objests? It doesn't have to splash, make waves or anything else, only that the floating object dips in 10-20 pixels and rotates as if the water had waves.

  • Click the mouse to spawn random sized objects:


    There are two instance variables for each object


    Which is like the base bouyancy rating. The higher the value the more it'll float, and if you set it low enough it will sink.

    and "bouyMod" which goes from 0 to 1 depending on how submerged the object is.. 0.1 being only a tiny bit in and 1 being full submerged.

    then the actual Y force is -(sprite.Bouy*sprite.bouymod*sprite.physics.mass)

    Another thing you could add is a way to increase the linear damping when in the water, and to reset it back to normal when it comes out of the water.

    ..also maybe a crash variable.. that reduces the objects speed when it collides with the water.

  • keepee,

    Just like to thank you for this. Its exactly what i want <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Hello there!

    Thank you Keepee for this example, it's very nicely done.

    I'm currently prototyping a game in wich the player has to load a boat with various stuff without unbalancing it.

    Your code is great for cubic object but I'm having a hard time keeping the steadiness of the boat, wich is rectangular for the moment. I tried to tweak the angular damping but it's of no use : the rectangle isn't going back to its original angle when it has been unbalanced...

    Do you have any clue about this ?

    Here is the .capx

  • Found a solution that didn't fry my brain !

    I just added some kind of floater at each horizontal sides and it seems to work, even if i'm not really sure about what kind of problems it's going to cause during the rest of the development.

    Using physics on the objects but not on the water seems weird but it seems to work.

    Here if anyone want to see :

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • seems weird but it seems to work.


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