How do I keep crouching under an object?

From the Asset Store
112 High-Quality destruction sounds for videogames
  • I'm very new to Construct (or game making in general). It took me awhile to make my character crouch the way I wanted - though it could probably be done easier.

    But now I can't figure out how to make them stay crouching when they are under something. As in they are crawling through a tunnel and I release the crouch button...I want them to stay crouching and not get stuck.

    I've tried several things (overlapping a "crouch zone" or offset overlapping), but nothing seems to work. I put the c3 file here if anyone wants to take a look. It's probably an easy fix, but I could use some help.

    dropbox.com/s/79tggtee49bwsn8/Test4.c3p

  • Yep overlapping a crouch zone seems fine. You put an invisible sprite in the tunnel area and make sure you cannot touch it unless you have already crouched and moved forward a bit. Then you adjust your on C release logic to include NOT overlapping crouch zone. That means when you release C, you remain crouched, but when you exit the crouch zone you would return to normal, also pressing and releasing C in the crouch zone wouldnt change anything.

  • Thanks for the reply! I've tried doing that, and it works when I'm in the crouchzone. If I release C, I stay crouched. However, when I leave the crouchzone I don't return to regular unless I press and release C again.

    For the time being it's fine, but I'd like to learn how to make it so the character will return to normal when leaving the crouchzone.

  • Rather than use 'set animation' for all the events you should give your player a state (instance variable). Then you can say if C is down set player state to crouch. If player is overlapping crouch area then set player state to crouch. Then you have a single event for the animation, if player.state is crouch, set animation to crouch. Combine this with an idle state that you set on C released or NOT overlapping crouch area and it should be fine.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • hmm Interesting. I'll give that a try. Thank you!

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