swimming?

0 favourites
  • 7 posts
From the Asset Store
Dodge hooks, collect starfishes and swim as far as you can!
  • So I got my character to swim. Once he hits the water, his behavior changes to 8 direction. but the thing is, I want the character to jump "out" of the water when he's overlapping the top edge of the water. Get what i'm puttin' down?

  • I kinda do. Hmm... how to do this...

    *Clickity click click*

    I don't have a way to share my demo (My computer doesn't like Dropbox apparently.) BUT you can do something that changes your character from 8 Direction mode (New band name idea! ^.^) back into Platformer mode once he leaves the water, either by overlap detect or collision detect with an object on the surface. I'd go with the object on the surface so it uses less power and performance. I'd then use a bit of code that translates to this: "On collision with surface, [INSERT whatever you did to flip the switch between platformer and 8Direction here] and adjust Vector Y to 300" or something.

    ...Does any of that make sense? I can tell it's a lot of words.

  • I actually did do that (switch from platformer to 8direction then back again) But the problem I had was when I would HIT the water, the character would spaz out for a second, then stop and kind of act in 8 direction.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'd get rid of the 8 Direction control all together.

    Instead set the fall speed of the character to 1/4 when in water making them fall slower. You can change movement speed and jump strength too.

    Simply change them back when your not overlapping water.

    This means you will sink if you aren't "jumping"

    Encase jumping doesn't work because you're not touching a platform simply making a condition, if overlapping water and pressing jump simulate control jump.

    Also, if you want special attributes when at the surface of the water you can have a condition

    If Player.BBoxTop is Higher than Water.BBoxTop allow for extra jump or anything else. (It just checks that the player is above the water line)

    Hope this helps and makes sense.

    From ShaunRemo

  • How would I make him swim like Donkey kong in Donkey kong country?

  • If I understood the video I looked up right (haven't played it) that looks about right. He has to constantly "jump" up in order to stay afloat, right? Or does he not sink if you don't press any buttons? If you don't want him to sink, you can add to the "on contact with water" code so it adjusts the gravity too.

  • Forget my previous post. But any control scheme should work so long as you completely turn off the "dry" mode once he hits the water. If it's not too hard, I might try something like this myself and go with a method for changing character/objects completely.

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