Sign in to follow this  
DefCom

YaBasic Help please

Recommended Posts

DefCom    270
Hi, I am an ICT teacher and some Y7s have asked me to teach them about games programming. Long story short, we are using win32 ps2 yabasic. I can't seem to get the keyboard input working properly.
repeat
	press$ = INKEY$
        //doing pong game here

UNTIL (press$ = "q")


but the screen is only updating when i press a key. I have spent ages on google and experimenting, but no success. We don't access to controllers. Any help would be greatly appreciated Thanks. [Edited by - DefCom on March 11, 2006 3:05:34 AM]

Share this post


Link to post
Share on other sites
Fruny    1658
INKEY$ is a blocking function. Meaning that your program stops and waits there for a key to actually be pressed.

However, as the documentation states, you can pass it a timeout parameter, specifying how long it is going to wait for a keypress. If no key is pressed by that time, it'll just return "".

So, if you do press$ = inkey$(0), it will try to grab a keypress on the fly but will not actually wait, so your program will keep running, and your screen will keep updating.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this