Something like
@LOOP
B=BUTTON(1)
IF B AND 1 THEN INC Y,-1
IF B AND 2 THEN INC Y,1
IF B AND 4 THEN INC X,-1
IF B AND 8 THEN INC X,1
CLS
LOCATE X,Y
PRINT "O"
VSYNC 1
GOTO @LOOP
Should do it.
INC is a new function that I think looks better than X=X+1, but it's the same thing.
How can i get a letter to move left/right/up/down when i press corresponding button button
Root / Programming Questions / [.]
ElzoBroCreated:
INC adds 1 to whatever variable you type, so
INC V
would add 1 to V.
if you add a number or variable after that you make it adds a different number to it
INC V,50 '(0+50, V is now 50)
INC V,36 '(50+36, V is now 86)
INC V,V '(86+86, V is now 172)
Before the only way to do this was
V=V+50
V=V+36
Same thing but a little fancier. If you want to do multiplication or something more complicated than addition you still have to set it up like
V=V*67
There's also DEC, which is the same thing except subtraction.
What does the VSYNC do?
I read the description of it in the Instruction List, but I don't understand what is meant by frames being "vertically synchronized." (I'm used to timing things in frames, but I'm a noob at graphics.)
Other than that, I gather that in your example it would make sure a minimum of time has passed since the last pass through the loop.
Is that the gist of it?
I'm not pretty sure but if I'm correct, VSYNC waits for n frames to pass. WAIT waits a n/60th of a second. Ever wondered that your image sometimes flickers with VSYNC but not WAIT? If something, for example a graphical clock took 0.75 frames to draw everything on the screen, then VSYNC 1 would wait 0.15 frames, but WAIT always delays n/60 seconds.
Again, I'm not sure this is the case.