`************************************** `* Title : Drop Clock `* Author : Phaelax `* Date : 1-22-2007 `************************************** speed = 5 radius = 5 size = radius*2 spacing = size*4 max_display = 120 offsetX = (screen width() - (8*size+7*spacing))/2 offsetY = (screen height() - 5*size)/2 rem x,y,active,targetX,targetY dim dots(max_display, 5) dim grav#(max_display) for i = 1 to max_display dots(i, 1) = rnd(640) dots(i, 2) = rnd(480) dots(i, 3) = 0 grav#(i) = 0.1 next i REM STUFF dim digits(10,3,5) for i = 1 to 10 for y = 1 to 5 for x = 1 to 3 read z digits(i,x,y) = z next x next y next i sync on sync rate 60 ink rgb(0,255,0),0 DO cls gosub _update gosub _position sync LOOP _position: for i = 1 to max_display if dots(i,3) = 1 if abs(dots(i,4)-dots(i,1)) < speed AND abs(dots(i,5)-dots(i,2)) < speed dots(i,1) = dots(i,4) dots(i,2) = dots(i,5) else angle# = atanfull(dots(i,4)-dots(i,1),dots(i,5)-dots(i,2)) dots(i,1) = dots(i,1) + sin(angle#)*speed dots(i,2) = dots(i,2) + cos(angle#)*speed endif else if dots(i,2) < 479-radius dots(i,2) = dots(i,2)+grav#(i) grav#(i) = grav#(i) + 0.1 if grav#(i) > 6 then grav#(i) = 6 if dots(i,2) > 480-size dots(i,2) = 480-size endif endif endif `circle dots(i,1), dots(i,2), radius box dots(i,1)-radius, dots(i,2)-radius,dots(i,1)+radius, dots(i,2)+radius next i RETURN _update: if seconds <> val(substring$(get time$(),6, 8)) time$ = get time$() seconds = val(substring$(time$,6, 8)) hour = val(substring$(time$,0, 2)) rest$ = substring$(time$,2,9) if hour > 12 then hour = hour-12 hr$ = str$(hour) if len(hr$) = 1 then hr$ = " "+hr$ time$ = hr$+rest$ j = 0 for i = 1 to len(time$) d$ = mid$(time$, i) if d$ <> ":" digit = val(d$) for y = 1 to 5 for x = 1 to 3 if digits(digit+1,x,y) = 1 inc j dots(j,3) = 1 dots(j,4) = offsetX+x*size + spacing*(i-1) dots(j,5) = offsetY+y*size else inc j dots(j,3) = 0 endif next x next y else inc j dots(j,3) = 1 dots(j,4) = offsetX+2*size + spacing*(i-1) dots(j,5) = offsetY+1*size inc j dots(j,3) = 1 dots(j,4) = offsetX+2*size + spacing*(i-1) dots(j,5) = offsetY+5*size endif next i endif RETURN REM Returns a substring of string 's' REM beginIndex, inclusive and starts at 0 REM endIndex, exclusive function substring$(s$, beginIndex, endIndex) s$ = left$(s$, endIndex) s$ = right$(s$, len(s$)-beginIndex) endfunction s$ REM DATA zero: data 1,1,1 data 1,0,1 data 1,0,1 data 1,0,1 data 1,1,1 one: data 1,1,0 data 0,1,0 data 0,1,0 data 0,1,0 data 1,1,1 two: data 1,1,1 data 0,0,1 data 1,1,1 data 1,0,0 data 1,1,1 three: data 1,1,1 data 0,0,1 data 1,1,1 data 0,0,1 data 1,1,1 four: data 1,0,1 data 1,0,1 data 1,1,1 data 0,0,1 data 0,0,1 five: data 1,1,1 data 1,0,0 data 1,1,1 data 0,0,1 data 1,1,1 six: data 1,1,1 data 1,0,0 data 1,1,1 data 1,0,1 data 1,1,1 seven: data 1,1,1 data 0,0,1 data 0,0,1 data 0,0,1 data 0,0,1 eight: data 1,1,1 data 1,0,1 data 1,1,1 data 1,0,1 data 1,1,1 nine: data 1,1,1 data 1,0,1 data 1,1,1 data 0,0,1 data 0,0,1