a for loop problem

Hi, Is it possible to have a for loop moving something around the screen while you are controlling something else? The best example of this I can think of is the game space invaders. The missiles are coming down the screen while you are moving the rocket left and right. I can only do one or the other not both at the same time. If it is possible can you please tell me the best way to go about it? thanks

Comments

a for loop problem

thanks for the quick reply. This problem has been bugging me a long time. I never realised how simple it was!

a for loop problem

You have to control the rocket in the same loop as the missles. TB is fast enough so that it appears to be doing two things at once. Here's a crude example


LET padcol=1
PRINT tab(75,padcol);"---"
DO
FOR r=1 to 74
PRINT tab(r,30);"0";tab(r,40);"0";tab(r,50);"0"
FOR i=1 to 100000
IF key input then
GET KEY direction
END IF
IF direction=303 and padcol<80 then ! Right arrow
PRINT tab(75,padcol);" "
LET padcol=padcol+2
PRINT tab(75,padcol);"---"
LET direction=0
ELSEIF direction=304 and padcol>2 then ! Left arrow
PRINT tab(75,padcol);" "
LET padcol=padcol-2
PRINT tab(75,padcol);"---"
LET direction=0
END IF
NEXT i
PRINT tab(r,30);" ";tab(r,40);" ";tab(r,50);" "
NEXT r
LOOP
END