Keyboard Management in Pascal - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Keyboard Management in Pascal

Pituxa2769Pituxa2769 Posts: 1Member
Hello!
I'm a beginner in Pascal and I'm working on a small WIngraph game. At some point on the game, the character (which is a block) has to lay down (the block gets half of its original height). I want this to happen while holding the arrow-down key but the way I implemented it is not actually working. Another problem I have is I don't know how to read keys simultaneously (that would be needed when, for example, running to the right and jumping).

That's how I tried to write it:

key:=readkey; case key of

arrow down code#:repeat

block gets half of its height

main loop of the program (drawing shapes etc)

until keypressed = false; <-- that's the problem. I expected the code to run fine while the key was pressed and as soon as its released, the block should get its normal height and then the program would run based on its main loop, but outside of this procedure.

Everything is working, except that key-holding thing.

Thank you!
Sign In or Register to comment.