Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Keyboard Management in Pascal
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.
0 · ·