Skip to content

Conversation

@ProfessorDey
Copy link

I noticed this has almost a complete lack of proper Keyboard support and so I've corrected this. The arrow keys now control the paddle and launching the ball:

  • UP : Launches the Ball.
  • LEFT & RIGHT : Move paddle side to side, instant switching, no interference with movement on KeyUp.
  • DOWN : Stops the paddle's movement immediately, useful for panic moments.

The paddle has a movement speed of 4 pixels per tick, this results in it moving at roughly the same speed as the ball so you can just barely make saves on the other side of the screen without making the game unplayably easy or too hard to control.

Due to implementation this does not use the smoothed mouse movement speed, so if that is as issue you know how to fix, preferably as something a player can select either ingame or as a compilation option, that would be appreciated as Arrows are still somewhat out of my league at the moment.

Enjoy

ProfessorDey added 5 commits March 11, 2018 13:58
This patch adds the input handling required for proper keyboard movement, including proper handling for instant left/right switching, should play fairly well.

Modifications to Game.hs are to follow this
Helps to remember when you're programming in Haskell and not Idris so you don't mess up the Eq instances.
This side of things is a bit awkward due to the fact I've had to use the simpler p = refPosPaddly ci for the mouse movement as I'm struggling to understand how I can replicate the effect of the smoothed mouse movement in a case statement like this or with at least a similar structure.

But it works fine and is very responsive.
Add Game.hs handling for Keyboard Input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant