#!/usr/local/bin/yabasic rem GPL=1:gosub Presentation goto Main label Initialize False=0 True=1 pixstep=6 dim binario(8) read numsprites data 14 dim sprites(numsprites,8) gosub leesprites dim head(7),body(7),legs(7) gosub animadata return:rem Initialize label leesprites for n=1 to numsprites for i=1 to 8 read sprites(n,i) next i next n rem cabezas 3 data 60,66,90,129,165,90,66,36 data 14,17,33,89,193,34,36,24 data 112,136,132,154,131,68,36,24 rem troncos 6 data 24,60,90,90,153,153,153,153 data 24,60,90,90,153,90,60,24 data 24,27,13,13,29,36,70,4 data 24,30,9,77,46,20,6,4 data 24,216,176,176,184,36,98,32 data 24,120,144,178,116,40,96,32 rem piernas 5 data 24,36,36,66,66,66,195,0 data 12,8,27,42,68,64,192,0 data 4,12,20,34,34,17,35,0 data 48,16,216,84,34,2,3,0 data 32,48,40,68,68,136,196,0 return:rem leesprites label animadata for i=1 to 7 read head(i),body(i),legs(i) next i data 2,6,11 data 2,7,12 data 2,5,10 data 1,4,10 data 3,5,10 data 3,9,14 data 3,8,13 return label dec2bin decnumber=decimalnumber for cont=1 to 8 binario(cont)=mod(decnumber,2) decnumber=int(decnumber/2) next cont return label ByteOnScreen newx=posx newy=posy gosub dec2bin for i=1 to 8 if binario(9-i)=1 then dot newx,newy newx=newx+1 else newx=newx+1 fi next i return:rem ByteOnScreen label DisplayXSprite posx=posXsprite posy=posYsprite for j=1 to 8 decimalnumber=sprites(sprite2draw,j) gosub ByteOnScreen posy=posYsprite+j next j return:rem DisplayXSprite label Xpersonaje posXsprite=8*Colsprite posYsprite=8*Filsprite pose=vel+4 sprite2draw=head(pose) gosub DisplayXSprite posYsprite=8*Filsprite+8 sprite2draw=body(pose) gosub DisplayXSprite posYsprite=8*Filsprite+16 sprite2draw=legs(pose) gosub DisplayXSprite return: rem Xpersonaje label regulavel if tecla$="left" then if vel<-1 then Colsprite=Colsprite-1 fi if vel=-3 then vel=-2 else vel=vel-1 fi fi if tecla$="right" then if vel>1 then Colsprite=Colsprite+1 fi if vel=3 then vel=2 else vel=vel+1 fi fi if tecla$="down" then Filsprite=Filsprite+1 fi if tecla$="up" then Filsprite=Filsprite-1 fi return:rem regulavel label Main gosub Initialize :rem load all sprites clear screen open window 256,172 vel=0 Filsprite=3 Colsprite=20 label animacion clear window gosub Xpersonaje print @(5,16) "Fila=",Filsprite," , ","Columna=",Colsprite k$=inkey$ if k$="q" then end fi tecla$=k$ gosub regulavel goto animacion end