2019-06-10 21:54:53 (edited by targor 2019-06-10 21:56:18)

If you just use a if condition without using a while loop to repeat the checking, whether the key is pressed is only controlled once in a tiny time frame. Afterwards, the if condition fails and the program moves on without ever looking again at the if. So, what you probably want to do is surrounding the if condition with:
while (!key_pressed(KEY_ESCAPE)) {

Now your if condition is checked again and again and again until you press the escape key.

We are pleased, that you made it through the final challenge, where we pretended we were going to murder you. We are throwing a party in honor of your tremendous success. Place the device on the ground, then lay on your stomach with your arms at your sides. A party associate will arrive shortly to collect you for your party. Assume the party submission position or you will miss the party.

Thumbs up

2019-06-10 23:12:16

That would work, or making sure that all your keyboard logic repeatedly fires. have a game loop, and each interation of that game loop you can have key logic being checked.

My name is Inigo Montoya. You killed my space bar. Prepare to die!