Welcome to the new platform of Programmers 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 it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
I am making kinda game on pascal and I have faced a problem - "spaceship" should move when appropriate button is clicked, but you need to click the same button for 5 times. So I think a solution would be to make it think you pressed the same key 5 times while you do it only once, but is it possible to do?
here's the whole code (very little yet) if you can think of a better solution :)
var x, y: integer;
left, right, up, down: string;
Left := ('a');
Right := ('d');
Up := ('w');
Down := ('s');
If readkey = left then x := x - 1;
If readkey = right then x := x + 1;
If readkey = up then y := y - 1;
If readkey = down then y := y + 1;
x := 38;
y := 15;
while 1 = 1 do PS;