Reading keys problem


I am trying to make a little game...The game is a little spaceship which moves to left when i press the left key, and right when i press the right key. When i press space it has to shoot.

The problem is:

When i hold down the left key, the spaceship keeps moving to the left side, when i press space it have to shoot and keep moving to the left side, but when i press space it just stops and shoot, and do not continue moving.

To detect what key have been pressed, i have written a little interrupt handler which reads value in port 60h and copy it to variable key.

What do i have to do.


  • Create an array of boolean to use as key-status, one boolean per each key you want to remember.

    Then, when pressed left button, set the "left button" boolean to TRUE, and when released, set to FALSE.

    Something like this, maybe:

    KeyStatus[Key] := TrueOrFalse;

    // Distance / no_carrier

Sign In or Register to comment.

Howdy, Stranger!

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