/* *//* Demo the player graphics *//* */  int x[4],y[4],dx[4],dy[4],shape[4],n; /* we use globals because they are faster than locals */main()$(  char i;  while(1) $(    poke(764,255); /* get ready to look for a key press */    pminit(); /* initialize player-missle graphics */    pmgraphics(1); /* single line resolution */    poke(710,0); /* background black */    putchar('\f'); /* clear the screen */    poke(0x2F0,1); /* turn off the cursor */    position(10,9);    printf("A PM Graphics Demo\n");    position(10,10);    printf("(look at PMDEMO.C)\n");    position(8,12);    printf("Press a key to restart.");    for(i=0;i<4;++i) $(      pmcolor(i,4*i,8); /* define the colors */      pmwidth(i,0); /* normal width */    $)    ballhack();    pmflush(); /* clear player missle graphics */  $)$)ballhack()$(  shape[0]="\10\0\0\0\0\0\0\0\0\0\0";  shape[1]="\10\0\0\0\0\0\0\0\0\0\0";  shape[2]="\10\0\0\0\0\0\0\0\0\0\0";  shape[3]="\10\0\0\0\0\0\0\0\0\0\0";  for(n=0;n<4;++n) $(    x[n]=rnd(150)+50; /* randomly select starting positions */    y[n]=rnd(150)+50;    while(!(dx[n]=rnd(3)-1)); /* randomly select directions */    while(!(dy[n]=rnd(3)-1));    chget(rnd(127)+1,shape[n]+2); /* randomly select a character for the shape */  $)  while(peek(764)==255) $( /* until a key is pressed */    for(n=0;n<4;++n) $(      plmove(n,x[n],y[n],shape[n]); /* move the shape */      x[n]+=dx[n]; /* add the directions */      y[n]+=dy[n];      if(x[n]<41) $(        dx[n]=1;        continue;      $)      if(x[n]>200) $(        dx[n]=-1;        continue;      $)      if(y[n]<32) $(        dy[n]=1;        continue;      $)      if(y[n]>223) $(        dy[n]=-1;        continue;      $)/* if we were looking for who we collided with, we would use hitpl(who,hitwho) */      if(hitpl(n,-1)) $( /* did it hit anyone? */        dx[n]=rnd(3)-1;        while(!(dx[n]=rnd(3)-1));        while(!(dy[n]=rnd(3)-1));        y[n]+=dy[n];        plmove(n,x[n],y[n],shape[n]);        pmclear(n);        chget(rnd(127)+1,shape[n]+2); /* new shape drawn from character base */        hitclear();      $)    $)  $)$)