Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit)

Thanks for the idea about "q/key-pressed? and q/key-as-keyword inside the update function" — I've just tried it and I can make it work!

The only problem I need to work-around is the frame rate. If the frame rate is too high (and even 30 fps is), then even a short key press will be counted multiple times. On the other hand, if the frame rate is too low (and even 10 fps can be), then a (very) short key press will not be recognized at all.

(1 edit) (+1)

Quil doesn't give you very much of this out-of-the-box, it's up to you to find a way to make your player move how you want them to move. For example, I made a player that moves quite jerkily here, with some "long key press" functionality similar to how you were looking for: http://www.quil.info/sketches/show/926b90ca28f03e9511165d337bb7ed6089f07381d1264.... I did this by adding a :last-move-time key into the state to prevent it from moving after it has just moved, so you don't need to mess around with frame rate. I also added the moving functionality into both update and key-press functions, just in case a key press was very very short and didn't get picked up by the update function.

Or you could look at my sliding puzzle code to get some ideas about how to animate the motion - I add a key into the :animations map in the state, then draw piece positions using lerp (linear interpolation) and the current time to get the current position. I remove finished animations in the update function.