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

Get help using Construct 2

Post » Sun Jan 15, 2017 9:38 pm

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:
https://www.dropbox.com/s/604lcrx7g79kr ... .capx?dl=0

P.S. I don't want to use the physics behavior.
B
38
S
10
G
9
Posts: 212
Reputation: 6,995

Post » Sun Jan 15, 2017 10:13 pm

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

Image

Image
Image Image Image
B
43
S
22
G
15
Posts: 378
Reputation: 12,252

Post » Mon Jan 16, 2017 6:37 am

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.
B
38
S
10
G
9
Posts: 212
Reputation: 6,995

Post » Mon Jan 16, 2017 8:49 am

I would use gravity and Vector Y, something like this:
Image

This is only an idea. If you use helper-sprites like mercuryus said, you could change the immersion. Maybe that looks nicer.
B
24
S
3
G
1
Posts: 451
Reputation: 2,165

Post » Mon Jan 16, 2017 5:06 pm

@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.
B
38
S
10
G
9
Posts: 212
Reputation: 6,995

Post » Mon Jan 16, 2017 5:54 pm

The box has to touch the floor, then it worked.
I made a better example:
http://superintendant-horse-41852.bitballoon.com/
This should work.

CAPX:
https://drive.google.com/uc?export=down ... kU5bzVEVEU
B
24
S
3
G
1
Posts: 451
Reputation: 2,165

Post » Mon Jan 16, 2017 6:08 pm

The example looks good :D. Could you fix the link of the .capx , it does not work ?
B
38
S
10
G
9
Posts: 212
Reputation: 6,995

Post » Mon Jan 16, 2017 6:11 pm

Try again now the link should work.
B
24
S
3
G
1
Posts: 451
Reputation: 2,165

Post » Mon Jan 16, 2017 8:02 pm

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.

Link:
https://www.dropbox.com/s/xrkf0df3nukyi ... .capx?dl=0
B
38
S
10
G
9
Posts: 212
Reputation: 6,995

Post » Tue Jan 17, 2017 9:46 am

Here a new try:
https://drive.google.com/uc?export=down ... 2Q2V3lGVE0

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.
B
24
S
3
G
1
Posts: 451
Reputation: 2,165

Next

Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], Blendi1223, gskunk, zenox98 and 59 guests