Here's some keyboard controls
To save you headaches you cannot use functions in loop commands
and you cannot have keyboard control without loops.
You can have input but that's different!
`Loop Example A
`By Jono
for a = 1 to 10
a$ = "Hello World!"
print a$
next a
This prints a$ variable for 10 times.
But what if you wanted to count by 2's?
for a = 2 to 20 step 2
print a
next a
Easy when you think about it!
Now here's keyboard control, for a green circle!
`The sync on tells the PC you will be controlling the screen rate
`Manually
`Sync rate is how fast you want it to go, 30 is the perfect amount
`To fast or slow will end up in bad slowdown I believe so at least
`Use the sync command whenever you update your screen
`Use the xpos value for our x position
xpos = 200
`Same here except with Y
ypos = 200
`Setup the program
hide mouse
sync on
sync rate 30
`Start the loop!
do
cls
ink rgb(0,255,0),1
`Cls clears the screen
`You can do anything to variables
`0 is off and 1 is on in computer talk
if upkey() = 1 then ypos = ypos + 7
if downkey() = 1 then ypos = ypos - 7
if rightkey() = 1 then xpos = xpos - 7
if leftkey() = 1 then xpos = xpos + 7
circle xpos,ypos,10
sync
loop
You can use the return command in a loop to return to normal
or you can use the exit command to exit a loop
Other examples of loops are
while, endwhile, and if I miss any I just can't remember them.
For keyboard control on other things use keystate(scancode)
here's an example
do
if keystate(47) = 1 then print "Hello World You Pressed V"
loop
The bad thing is that scancode's are different,if you use a france
keyboard V would probably be different.
Experiment with the keystate() command, and the main key commands
such as
spacekey()
controlkey()
etc.
<Insert Signature Here>