Simple water

Get help using Construct 2

Post » Thu Nov 01, 2012 3:02 pm

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.RecGames2012-11-01 15:03:31
Borka223 from RecGames
B
14
S
4
G
5
Posts: 39
Reputation: 2,987

Post » Thu Nov 01, 2012 4:22 pm

Click the mouse to spawn random sized objects:
bouyancy

There are two instance variables for each object

"bouy"
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.

B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Wed Feb 13, 2013 12:31 pm

@keepee,

Just like to thank you for this. Its exactly what i want
B
44
S
15
G
9
Posts: 1,096
Reputation: 11,013

Post » Thu Apr 04, 2013 1:44 pm

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
https://docs.google.com/file/d/0B-727M6ikDE_LVBOZmJ2WjF5MVU/edit?usp=sharing
B
8
S
3
G
2
Posts: 35
Reputation: 2,177

Post » Thu Apr 04, 2013 7:58 pm

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 :
https://docs.google.com/file/d/0B-727M6ikDE_VHJmbXRXNXJ0Nzg/edit?usp=sharing
B
8
S
3
G
2
Posts: 35
Reputation: 2,177

Post » Sat Apr 06, 2013 6:23 am


seems weird but it seems to work.


__________________________________________________
http://www.mmoggg.de/
B
1
Posts: 1
Reputation: 377


Return to How do I....?

Who is online

Users browsing this forum: Kagubro, Yahoo [Bot] and 23 guests