01-08-2005, 12:10 PM
you may remember my old post about how to fix a box from flickering or something, well now i want to redo that program where azz before, two dots randomly move about inside a box and if the dot reached the edge, it looped back around to the other side. well now with my new profound knowlge of arrays and the TYPE command thing i tryed to have 80 dots going at the same time. i think there's a problem, mainly 'cause it wont start (really?)
here, what did i do wrong so i can learn from my mistakes.
[syntax="QBASIC"]SCREEN 13
TYPE dottype
a AS INTEGER
b AS INTEGER
END TYPE
DIM dot(1 TO 80) AS dottype
FOR i = 1 TO 80
FOR ii = 1 TO 80
dottype(i).a = 40
dottype(ii).b = 40
NEXT: NEXT
RANDOMIZE TIMER
DO
LINE (19, 19)-(101, 101), 4, B
frld = 0
DO
frld = frld + 1
LOOP UNTIL frld = 2500
FOR i = 1 TO 80
FOR ii = 1 TO 80
RN = INT(RND * 4) + 1
IF RN = 1 THEN dottype(i).a = dottype(i).a - 1
IF RN = 3 THEN dottype(i).a = dottype(i).a + 1
IF RN = 2 THEN dottype(ii).b =dottype(ii).b + 1
IF RN = 4 THEN dottype(ii).b = dottype(ii).b - 1
NEXT: NEXT
FOR i = 1 TO 80
FOR ii = 1 TO 80
IF dottype(i).a < 20 THEN dottype(i).a = 100
IF dottype(i).a > 100 THEN dottype(i).a = 20
IF dottype(ii).b < 20 THEN dottype(ii).b = 100
IF dottype(ii).b > 100 THEN dottype(ii).b = 20
NEXT: NEXT
FOR i = 1 TO 80
FOR ii = 1 TO 80
PSET (dottype(i).a + 1, dottype(ii).b + 1), 9
PSET (dottype(i).a + 1, dottype(ii).b), 9
PSET (dottype(i).a, dottype(ii).b + 1), 9
PSET (dottype(i).a, dottype(ii).b), 9
NEXT: NEXT
LOOP UNTIL INKEY$ = "q"[/syntax]
here, what did i do wrong so i can learn from my mistakes.
[syntax="QBASIC"]SCREEN 13
TYPE dottype
a AS INTEGER
b AS INTEGER
END TYPE
DIM dot(1 TO 80) AS dottype
FOR i = 1 TO 80
FOR ii = 1 TO 80
dottype(i).a = 40
dottype(ii).b = 40
NEXT: NEXT
RANDOMIZE TIMER
DO
LINE (19, 19)-(101, 101), 4, B
frld = 0
DO
frld = frld + 1
LOOP UNTIL frld = 2500
FOR i = 1 TO 80
FOR ii = 1 TO 80
RN = INT(RND * 4) + 1
IF RN = 1 THEN dottype(i).a = dottype(i).a - 1
IF RN = 3 THEN dottype(i).a = dottype(i).a + 1
IF RN = 2 THEN dottype(ii).b =dottype(ii).b + 1
IF RN = 4 THEN dottype(ii).b = dottype(ii).b - 1
NEXT: NEXT
FOR i = 1 TO 80
FOR ii = 1 TO 80
IF dottype(i).a < 20 THEN dottype(i).a = 100
IF dottype(i).a > 100 THEN dottype(i).a = 20
IF dottype(ii).b < 20 THEN dottype(ii).b = 100
IF dottype(ii).b > 100 THEN dottype(ii).b = 20
NEXT: NEXT
FOR i = 1 TO 80
FOR ii = 1 TO 80
PSET (dottype(i).a + 1, dottype(ii).b + 1), 9
PSET (dottype(i).a + 1, dottype(ii).b), 9
PSET (dottype(i).a, dottype(ii).b + 1), 9
PSET (dottype(i).a, dottype(ii).b), 9
NEXT: NEXT
LOOP UNTIL INKEY$ = "q"[/syntax]
quote="whitetiger0990"]whitetiger is.. WHITE POWER!!! [/quote]
Here
Here