Skip to main content

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

Hello, it's great to see I've inspired a game! I'm not super experienced with Quil, but I think I can help - I don't think Quil has the exact functionality you're looking for, but you can still make it work. For your use-case, I'd change the keypress function to modify the game state to record that the key is pressed, and add a key-released function to record that it is no longer pressed, and do the check-and-move code inside the game's update function using the info recorded in the game state. Does that make sense? Good luck with the game jam, and feel free to ask if you have any more questions!

Edit: actually if you only need the most recently pressed key, you could probably ignore the stuff I said about recording key presses in the state and just use q/key-pressed? and q/key-as-keyword inside the update function instead of inside the key-pressed function.

(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.