Issue with control inputs

This forum is currently in read-only mode.
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • Hey everyone, new guy here and really having fun getting into Construct.

    The problem appears to be very small, but I can't locate the issue for the life of me. I've built a system in the event editor that allows the player to put the character in a variety of states (walking, running, crouching, etc.) I have it set up so that when the player presses the crouch button, the character crouches...the system recognizes that the character is in the "crouch state," the animation changes to reflect this, etc. It works just fine, with one small issue; the very first time you press the button, it is not recognized. However, it works perfectly every subsequent time.

    I was really confused by this, so I actually deleted everything else in the entire event list except the couple of events needed to actually do the crouch and this still happens. I also tried changing which key the command is assigned to and this makes no difference either. Any ideas?

  • I see no one seems to have any ideas, so I'll try to clarify a little bit.

    On the player sprite I've created a private variable that detects when the player is crouching. At 0 he is not, at 1 he is. The player toggles this state by hitting the "shift position" control, which I've currently got set to shift. Whenever the crouching state variable is at 1, the animation/speed/etc all change to reflect this. It works like a charm with the exception of the very first press of the shift key...you must tap the key twice to get the player to crouch the first time, every other time it works just fine.

    Any ideas?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi,

    A posted cap along with a description of the problem always gets a solution faster than just a description.

    I recreated what you described in your second post and it work fine.

    + MouseKeyboard: On key Shift pressed
        + Sprite: Value 'crouching' Equal to 0
        -> Sprite: Set 'crouching' to 1
        + System: Else
        -> Sprite: Set 'crouching' to 0
    + Sprite: Value 'crouching' Equal to 0
    -> Sprite: Set height to 50
    + Sprite: Value 'crouching' Equal to 1
    -> Sprite: Set height to 25[/code:1ziy5fze]
    
    In your cap is the initial value of the crouching variable set to one of the two 0,1 or is it another value.  It may just be something that's amiss with the order of your events, although I can't say for sure.  If you post the cap a solution should be found fairly quickly.
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)