Handle movement with key press or key down?

0 favourites
  • 2 posts
From the Asset Store
Random Maze Generator with Door & Key System - tutorial capx
  • I have a design/structure question related to player platform behavior movement. Custom controls is set to true. The main question is related to ON_KEY_PRESS vs ON_KEY_DOWN.

    Here is the keyboard code:

    <img src="http://dl.dropbox.com/u/12667027/Construct%202/Keyboard%20Movement%20Handling/Player%201%20Keyboard%20Events.png" border="0" />

    Here is the actual movement code itself.

    <img src="http://dl.dropbox.com/u/12667027/Construct%202/Keyboard%20Movement%20Handling/Player%20Movement%20Events.png" border="0" />

    For example, the jump is implemented as ON_KEY_PRESS, but I could have just as easily implemented it as ON_KEY_DOWN.

    Which do you think is better? Sometimes it just feels like my character isn't too responsive when jumping, especially when attempting to do lots of little hops.

    Keyboard logic is separated from movement logic for purposes of handling multiple players.

    Looking at this code, what do you think? Is this a poor way of implementing keyboard controls, player movement and animation?


    -- cacotigon

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hmm, I just did some more checking, sometimes it seems like with this code when the CPU usage is maxed out and the frame rate drops, the jump release key code sometimes won't detect, so even if I just barely tap the key, the player sprite will jump to its furthest height.

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