11.07.2015 Views

Untitled - TRS-80 Color Computer Archive

Untitled - TRS-80 Color Computer Archive

Untitled - TRS-80 Color Computer Archive

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

the screen wherever desired. ButPUT and GET create slow, flickeryanimation in BASIC. Instead ofPUT and GET, this program makeseach puzzle piece into a bob andanimates it with OBJECT commands. The result is much smoother animation. You can still noticeslight jerkiness in the piece's motion when you carry it with thepointer, but this is due to delayscreated by background routines activated by ON TIMER.The process of creating a bobinvolves several steps. First, GET isused to capture all the graphic datafor each shape in an integer array.This integer array is then convertedinto a string array. The string array,in turn, is concatenated into a general string array that holds the bob'sfeatures and is used to animate thebob with OBJECT.DRAW commands. This simple method of creating bobs and sprites has not, tomy knowledge, been documentedwidely.Amiga JigsawFor instructions on entering this program,please refer to "COMPUTEI's Guide to TypingIn Programs" in this issue of compute!.FOR irow=0 TO rLast *FOR icoL=0 TO cLast*WINDOW OUTPUT 3*x=FNXYfmRC{icoL+1,xwidth):y=FNXYfmRC(irow+1,ywidth}*GET (x,y)-(x+xwidth-l,y+ywidth-l),a(0,0Hs $ ( i coL, i row ) = " " *iLast=getsize-l-«FOR i=3 TO iLast:3$(icoL,irow)=s$(icoL,irow)+MKI?(a(i,0)):NEXT*WINDOW OUTPUT 2*i=icoL+ncoLs.pzL*irow*X=FNXYfmRC(coLs(i),xwidth):y=FNXYfmRC(rows(i) .ywidth)*PUT (x,y),a(0,0)*pcoL(icoL,irow)=coLs(i):prow{icoL,irow)=rows(i)*NEXT: NEXT-*WINDOW 2*1 Shuffle the pieces-*FOR i=0 TO 20*Pick.RC:-*FOR j = l TO 2*coL(j)=INT(ncoLs.pzL*RND):row(j)=INT(nrows .pzL*RND)*NEXT j*IF coL(l)=coL{2) AND row{l)=row(2) THEN GOTO Pick.RC-*FOR j=l TO 2 *x(j)=FNXYfmRC(pcoL(coL{j),row(j)) , xwidth)*y(j)=FNXYfraRC(prow(coL(j),row{j)) , ywidth )■*GET (x(j),y(j))-(x(j)+xwidth-l,y(j)+ywidth-l),a(0,j-1)*LINE (x(j),y{j))-(x(j)+xwidth-l,y( j)+ywidth-l) ,0,bf*NEXT j*PUT (x(l),y(l)),a(0,l):PUT (x(2),y(2)),a(0,0)*SWAP pcoL(coL(l),row(1)),pcoL{coL(2) ,row(2) )*SWAP prow{coL(1),row(l)),prow(coL(2),row(2))-

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!