0 Favourites

How can I make a box floating on the surface of the water ?

  • Hi. I want to make "BoxMovable" to float on the water using the platform behavior, if possible, because I need it when player is pushing the box.

    When the box is falling from a distance in the water, I want it when is overlapping the water, wait 1 second, and then go up until it reaches the surface of the water and stay there, and activate the sine behavior (for floating effect).

    I want that the player, when is in the water, to be able to push the box on X axis, too. Any tips ? I've tried some things but didn't worked. I hope that someone will modify this .capx for me, thanks!

    Here is the link:

    P.S. I don't want to use the physics behavior.

  • Add a helper sprite beneath the water surface and disable platform on overlapping (also enable vertical sin for floating effect)...

  • If I disable it ... than I wont be able to push the box while in the water. And if the box is already in the water, kn the bottom, it wont go up to the surface.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • I would use gravity and Vector Y, something like this:

    This is only an idea. If you use helper-sprites like mercuryus said, you could change the immersion. Maybe that looks nicer.

  • Asmodean You tried this and it worked for you ? It doesn't for me .

    Is it possible to somehow force the box (when is, lets say, 200 (or more) pixels Y distance from the surface of the water) to move up until is reaches the surface of the water, and stay there ? This is for when I push the box and falls in the water.

  • The box has to touch the floor, then it worked.

    I made a better example:

    This should work.


  • The example looks good . Could you fix the link of the .capx , it does not work ?

  • Try again now the link should work.

  • Thanks a lot Asmodean , your example works fine !

    I forgot to mention that I want to control the water movement with a lever, so I can make it go up or down. I've done this myself but the issue now, is, that the system you've created doesn't match with this.

    Please take a look. Move the player over the lever and press E to activate the water movement so you can see what I mean.


  • Here a new try:

    I changed the origin from the boxes back in the middle and cropped the transparent from the water. It's much easier this way with the coordinates.

    One thing doesn't work. If you push a box in the water when it's rising and there is a box already floating, you got funny side effects. The easiest way to avoid that is don't let the player push a box in the water when it's rise.

    I look if I could fix that, but I you didn't need pushing boxes in the water when it's rising, it should all work.

  • Well, yeah, it doesn't work properly . Thanks you again for your help !

  • Sorry it took so long but I had a very bad cold.

    Please have a look If this works better for you:

  • Sorry it took so long but I had a very bad cold.

    Please have a look If this works better for you:

    [/quot > > Don't worry . > It is better. But the box that is on the bottom of the water, at start of layout, I would want it to move up faster that the water is rising, and rich the surface - instead of "teleporting" up. > I've noticed that if I push a box out of the water it remains in the air. > I don't understand all those conditions that you've made in the event sheet... so it's confusing for me . > > I've modified the capx a bit: >

  • I see what you mean. The boxes can have different states: floating. Floating= -1 means the box is on the floor with water from below. 0 is a box that is pushed in the water. They changed the state, depends what happend. Other states has to be added for other possibilities, like pushing a box out of the water. The box floats because the gravity is 0.

    I will make comments in the capx what the events do. So you can alter it like you want.

  • Now the with comments:

    The problem is if you want to much, it will get too complicated with too much side effects. The Platform-Behavior isn't really designed for this and you can get very funny side effects. There will be a point where the physic-behavior is easier to use.

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