Quicksand in platformer

0 favourites
  • 3 posts
From the Asset Store
Make your dream action platformer game effortlessly with this template!
  • How could I implement Mario-style quick sand in a platform game? I'd like the player to sink into the sand slowly when walking on it, but with rapidly jumping it should be possible to get out of the sand.

    Example at around 0:40 mark:

    https://youtu.be/SwWYV1kaD60?t=40s

    I have been unable to achieve this with any great results so was wondering if there are any tips/examples on how to set this up?

  • Your character has to be made of two sprites - an invisible sprite with Platform behavior and a "skin" sprite with all character animations.

    Add an instance variable SandDepth. When walking on quicksand, increase the value of SandDepth, move the skin sprite lower down and decrease platform speed and jump strength. On jump, decrease the value of SandDepth.

    On every tick set skin sprite position to platform sprite, plus SandDepth.

    Something like this:

    PlatformSprite overlapping QuickSand

    ...Add 1 to SandDepth

    ...PlatformSprite set platform speed to max(100-self.SandDepth, 0)

    On every tick

    ...SkinSprite set position to X=PlatformSprite.x, Y.PlatformSprite.y+SandDepth

    PlatformSprite On Jump -> SandDepth set to max(SandDepth-20, 0)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you dop2000 , this was super helpful!

    I ended up doing it a little bit differently in the end (by using two sprites for the quicksand instead of offsetting the character animation sprite), but you gave me great ideas that allowed me find a solution, so I appreciate your help very much! Thanks again!

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