Physics objects go swimming!

This forum is currently in read-only mode.
  • I've made water that can combine with physics objects for buoyancy and displacement. Nothing very complicated - objects are pushed upwards based on their individual buoyancy, and the water level rises based on the number and size of objects in the water. Both of these scale for how much of the object is submerged.

    Anyone who wants to use this is most welcome. I just added the water as a part of my game - though if I'd realised how annoying it would be to implement, I probably wouldn't have done it. Construct is bound to get inbuilt physics water sooner or later!

    Still to do:

    • Make scaling more accurate for ellipses (if motivated enough).
    • Slow down objects to simulate water drag (when Get Force is added).

    http://dl.dropbox.com/u/906550/Construct/water.cap

    EDIT: Updated link

  • Nice demo! It runs really slow on my computer when an object is overlapping the surface of the water though. But on a faster computer I bet it's fine.

    Anyway, I just wanted to mention also that you don't need to make a loop for each event. You can place all of your box floating and displacement code into one loop like so:

    <img src="http://i44.tinypic.com/2lc9r3t.png">

    This still works just fine. You could make a second loop for the circle the same way, and have just two loops instead of the ten loops you have now.

  • So that's how it works! I started out trying to do that, but kept getting anomalous results (eg, when something fell into the water, all of the water sprites would gain height, instead of just the relevant one). Judging by your example, I must have been putting the loop condition in the wrong order.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Can you please reupload your exapmle? link not works.

  • Oh, sure.

    I couldn't find the original version, so here's one with some bonus cruft (like water displacement). The events are grouped, though, so you can definitely find the buoyancy stuff.

    http://dl.dropbox.com/u/906550/Construct/water.cap

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