How do I make my character swim?

Get help using Construct 2

Post » Fri May 29, 2015 12:36 am

I started a new game to learn about platforms.

Well, how do I make it so my platformer can swim?

So I make it a sprite called water
Add something like he falls down a little deeper every second when touching the water.
Pressing an up button would make him swim upward.
Pressing a down button would make him swim downward.
Left and Right would still be side to side.

How would I code this?

Maybe water won't have any behavior.
Maybe set the player gravity to (normalgravity/2) when touching the water? I think this will possibly make him fall slowly.
Maybe something like increase the y by vector 10 or something so it's like he swims upwards.

Is there a better way to code this?
Posts: 15
Reputation: 226

Post » Fri May 29, 2015 1:48 am

Actually you don't have to do anything complicated. You can just set a condition where, every tick that player is not pressing up, character y +2, or a number that you prefer. That way, it slowly sinks only if the player is not pressing up which means it is swimming up. For down, left and right, just set the movement to the appropriate x and y coordinates. Just remember to set your platformer control to off when it is in collision with the water object.
Posts: 693
Reputation: 20,637

Return to How do I....?

Who is online

Users browsing this forum: dioking, mekonbekon and 2 guests