10-08-2004, 07:50 PM
hey everyone,
I am reading Vic's Qbasic toutorials and i am on 3.
I get how to make a pixel move with the user pressing keys like w s a d. and i get clipping but then he talks about making a ball bounce around a screen. I'll post the code and mabye you can help me understand what it means ive been re reading this for a week i just dont understand it. Heres the code he uses
-----------------------------------------
so i dont know what WAIT &H3DA, 8 does but in the tout. he says it just makes it look better. ok so the part REALLY REALLY REALLY dont get is the
it would be awsome if you could explain it thanks.
I am reading Vic's Qbasic toutorials and i am on 3.
I get how to make a pixel move with the user pressing keys like w s a d. and i get clipping but then he talks about making a ball bounce around a screen. I'll post the code and mabye you can help me understand what it means ive been re reading this for a week i just dont understand it. Heres the code he uses
-----------------------------------------
Code:
SCREEN 13
x = 50: y = 50
xadj = 1: yadj = 1
DO
press$ = INKEY$
WAIT &H3DA, 8
LINE (x - 8, y - 8)-(x + 8, y + 8), 0, BF
CIRCLE (x, y), 7
PAINT (x, y), 4, 15
IF y <= 20 THEN yadj = 1
IF y >= 180 THEN yadj = -1
IF x >= 300 THEN xadj = -1
IF x <= 20 THEN xadj = 1
x = x + xadj
y = y + yadj
LOOP UNTIL press$ = "q"
so i dont know what WAIT &H3DA, 8 does but in the tout. he says it just makes it look better. ok so the part REALLY REALLY REALLY dont get is the
Code:
IF y <= 20 THEN yadj = 1
IF y >= 180 THEN yadj = -1
IF x >= 300 THEN xadj = -1
IF x <= 20 THEN xadj = 1
x = x + xadj
y = y + yadj
it would be awsome if you could explain it thanks.