0 Favourites

How do I allow player to temporarily bypass solid objects?

  • My game is played from a Zelda-like perspective.

    So far, it's been easy to handle collision; apart from the visual layer, I have a separate collision layer, not visible to the player, with bright red squares marking off everywhere the player can't go.

    However, in my game the player has an 'acrobatics' ability. When pressing the acrobatics button plus the appropriate direction, the player is supposed to be able to cross some (but not all) physical obstacles.

    So, for example, instead of being stopped by a fence, he vaults over the fence. Instead of being stopped by the wall of a building, he runs up the wall and lands on the roof of the building.

    I'm pretty sure what I need to do is have a new layer that defines 'acrobatics areas' of a given level; areas where pressing a certain key combination (acrobatics key plus appropriate direction) will produce a certain result in terms of player movement and animation. But how do I do this on the player movement side? Is there a way to make the player 'intangible' for passing through the wall and force a specific pattern of movement (run up the wall and land on the roof, vault the fence, etc.) that temporarily overrides the player's normal controls, while still making the player vulnerable to bullets and other projectiles?

    Thanks!

  • Create a condition that check a specific animation of your char. When true, disable Solid behavior.

  • Hmm... if the player temporarily turns non-solid, would that prevent the player from being hit by bullets/projectiles during that stretch of time? That would be a major problem...

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Hmm... if the player temporarily turns non-solid, would that prevent the player from being hit by bullets/projectiles during that stretch of time? That would be a major problem...

    That could be a bonus side-effect of doing an acrobatic move.

  • > Hmm... if the player temporarily turns non-solid, would that prevent the player from being hit by bullets/projectiles during that stretch of time? That would be a major problem...

    >

    That could be a bonus side-effect of doing an acrobatic move.

    Could be, but would be less than ideal.

    Is there a way to 'override' the player's movement and position, including collision with walls, without changing his ability to interact with bullets/projectiles?

  • There's a couple of possibilities.

    If you want the player to remain solid to bullets while the acrobatic ability is active,

    The one on my mind is, have the kinds of objects that can be temporarily not solid (on your collision layer) be different from the objects that are always solid. (e.g, SolidWall and AcroWall)

    Your Acrowall would have different animations based on direction and style; "VaultFenceUpDown" "RunWallUp".

    Then, when the player character collides with the Acrowall; if they're not in Acrobatics Mode, they just stop.

    If they're not going one of the acceptable directions of the acrowall? (Trying to cross the runwall going left or right) they stop.

    If they're in Acromode and going the right direction, then,

    (Player->8-Direction.StartIgnoringInput)

    Then, AcroWall->Solid.Disable

    Player.AnimationChange.RunWallUp

    Player.8Direction.SimulateInput("Up")

    until they're no longer overlapping the Acrowall. Then you reenable Acrowall Solids, 8-Direction input, and normal animation.

    Make any sense?

  • This is one problem that Construct 2 could solve if it had the container(I think that's what it's called) feature from Unity3D.

    Basically you set what can interact with what, so you could have players passing through objects e.g. forcefields that enemies couldn't.

    Anyway, the only way I can think of you to do it is to either disable solid, do a really super complicated event that I can't think of and probably wouldn't/would work, or just change your ability to a kind of teleport.

    So there's that, or making the player invulnerable.

  • That sounds an awful lot like "families," Nesteris.

  • Thanks so much to both Nesteris and Unnatural20 for great and very informative replies! I really appreciate it.

    My only concern with dropping the solid property of the wall temporarily is that if my game is multiplayer online, it might allow other players to 'walk' through the fence while the acrobatic move is active. If I have to pick one object being solid or another, the player being invulnerable might be preferable to allowing other players to 'cheat'.

    Could this be solved by simply not updating the state of the 'Acrowall' object for multiplayer? So it's fully client-side, and an acrowall being 'non-solid' on my client has no impact on other players? Or are things like that forced to update/sync when using multiplayer?

  • Honestly, I know nothing of multiplayer; that might just be something you need to try!

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