Player to swim

0 favourites
  • 13 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • How do I get the player to swim?

    Ability to jump in water, but not in mid air.

  • iF keyIsDown == jumpButton

       IF player object and water object are overlapping

       THEN playerY+=1 (or you could simulate jump control on the player platform behavior)

  • Thanks, but I don't quite understand yet.

    Add event: -- Add Action?

    Add sub events: ?

  • ensure you you a keyboard object in your project.

    add event: Keyboard>KeyIsPressed>Space (or whatever you use for jump)

    add condition: Player>IsOverlappingOtherObject>Water

    add action: Player>Platform.VectorY = Player.Platform.VectorY + swimUpVector

    where swimUpVector is the amount of upward velocity per tick that should be added to the player. try 250 or so and work from there.

  • I tried adding "swimUpVector" to the player's variables

    then I added it to action: "Set Vector Y"

    and to that I put in: Player.Platform.VectorY + swimUpVector

    but then it told me that "swimUpVector" is still an unknown variable.

  • swimUpVector is not a variable you make in construct its a number you set based on how high you want the jump to be, if you want the player to go higher set it to like 500, that will be a normal jump (i think 650 is default jump height in construct 2 platform behavior.)

    so it should look like

    add event: Keyboard>KeyIsPressed>Space (or whatever you use for jump)

    add condition: Player>IsOverlappingOtherObject>Water

    add action: Player>Platform.VectorY = Player.Platform.VectorY + 250

  • I'll give this a try.

    ===

    This doesn't seem to be working, as I might be missing something still.

  • or if you've added swimUpVector to the player's variables, then it will be player.swimUpVector.

  • Upload your capx if you are still having problems. (please don't be beta, please don't be beta)

  • Yes, that is a lot better.   It finally worked.

    Thank you for your help. He can swim now.

  • On space pressed >

    >if PlayerIsSwimming <- boolean for if they are swimming

    >> Player | Set Platform Y Vector to swimupvector (make sure it's negative)

    With this, if your player is swimming when you hit space, their Y vector will go up that much.

    Make sure your Y vector is negative if you want to go up. Positive Y vector = down.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • worked, except he jumps a little too high when coming out of the water.

  • And thanks for your help too.

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