よし、今からハイスコア勝負だ。
俺、12点!!
//----------------------------------------------------------------------------
// PONPON.
//----------------------------------------------------------------------------
#packopt name "ponpon"
#module "PF_X"
#deffunc init_PF_X int mId,int wi,int hi,int sMax,int RGBFLG
PCGID=mID:PCGMax=sMax:PCGScreenWidth=sMAX<<3:PCGScreenHeight=8
baseID=ginfo(2):buffer PCGID,PCGScreenWidth,PCGScreenHeight,0
color:boxf:mref VRAM,66:gsel baseID:pfxw=wi:pfxh=hi
if RGBFLG=0{RGBPLANE(0)=0:RGBPLANE(1)=2:RGBPLANE(2)=1}
else {RGBPLANE(0)=2:RGBPLANE(1)=1:RGBPLANE(2)=0}
dim PF_X_STATUS,pfxw,pfxh:tbit=1,2,4,8,16,32,64,128:return
#defcfunc hex str OneByte
d="00"+OneByte:d=strmid(d,-1,2)
hh=peek(d,0)-'0':hh-=((hh>9)*7)+((hh>24)<<5):hh=hh*((hh>0)and(hh<16))
hl=peek(d,1)-'0':hl-=((hl>9)*7)+((hl>24)<<5):hl=hl*((hl>0)and(hl<16))
return (hh<<4)+hl
#defcfunc VramAddress int x , int y
return ((PCGScreenHeight-1-y)*(((PCGScreenWidth*3)+3)&0xfffffffc))+(x*3)
#deffunc writeCHRLine int sID,int plane,int sLine,int sData
x=sID<<3:y=sLine:s=sData:for o,0,8:dat=0xff:if(s&tbit(o))=0:dat=0
poke VRAM,VramAddress(x+7-o,y)+RGBPLANE(plane),dat:next:return
#deffunc RBYTE int sID , str sData
if sID<0|PCGMax<=sID{return}:PCGData=sData:for i,0,24
writeCHRline sID,i/8,i\8,hex(strmid(PCGData,i<<1,2)):next:return
#deffunc WBYTE2 int sx,int sy,int sID
if (sx<0|sy<0|sx>=pfxw|sy>=pfxh)=1:return
if PCGMax<0|PCGMax<=sID{return}:PF_X_STATUS(sx,sy)=sID
pos sx<<4,sy<<4:gzoom 16,16,PCGID,sID<<3,0,8,8:return
#deffunc WBYTE int sx,int sy,int cno,str data
wx=sx:wy=sy:source=data:len=strlen(source):index=0:while(index<len)
id=peek(source,index):wy+=(id=0x64)-(id=0x75):wx+=(id=0x72)-(id=0x6c)
id=(id*(id>=0x20&id<=0x5f))-(id<0x20|id>0x5f):WBYTE2 wx,wy,id
wx+=(id>0):index++:wend:return
#defcfunc STATUS int sx,int sy
if (sx<0|sy<0|sx>=pfxw|sy>=pfxh)=1:return 0
return PF_X_STATUS(sx,sy)
#deffunc STATUSCLS
for i,0,pfxw:for o,0,pfxh:PF_X_STATUS(i,o)=-1:next:next:return
#global
init_PF_X 1,40,30,96,0
#define locate(%1,%2) pos (%1)<<4,(%2)<<4
//----------------------------------------------------------------------------
screen 0,32*16,24*16:color:boxf:color 255,255,255:font "MS ゴシック",16
RBYTE 0x41,"00000000000000003c7e7edbdbdb7e663c7e7edbdbdb7e66" // A:ponpon
RBYTE 0x42,"0000000000000000dfdfdf00fdfdfd000000000000000000" // B:壁
RBYTE 0x43,"00000000000000004428107c107c10004428107c107c1000" // C:お金
RBYTE 0x44,"925438fe38549200925438fe38549200925438fe38549200" // D:イガイガ
RBYTE 0x45,"ffffffffffffffff0000000000000000ffffffffffffffff" // E:ENERGY
//----------------------------------------------------------------------------
randomize:STATUSCLS:hs=0:h=5:en="EEEEEEE "
*start:redraw 0:s=0:g=0:px=2:py=2:pv=1:for i,0,32:for o,0,22:t=" "
if(o<2|o=21|i=0|i=31|((o+3)\4=0&(i!=2&i!=29))):t="B"
WBYTE i,o,7,t:next:next
*set:for i,4,21,4:for o,1,5:WBYTE rnd(20)+5,i,7,"DCD":next:next:
//----------------------------------------------------------------------------
*mainloop:redraw 0:WBYTE px,py,7," ":stick c,5
px+=-((c&0x01)!=0&STATUS(px-1,py)=0x20)+((c&0x04)!=0&STATUS(px+1,py)=0x20)
py+=pv:t=STATUS(px,py):py-=pv*(t=0x42):pv*=(t!=0x42)-(t=0x42):
h-=(t=0x44):if t=0x43{s++:if s\10=0{h+=(h<7):goto *set}}:if s>hs :hs=s
WBYTE 3,0,7," ":locate 3,0:print "HI−SCORE:"+hs
WBYTE 20,0,7," ":locate 20,0:print "SCORE:"+s
locate 6,22:print "ENERGY:"+h:WBYTE 13,22,7,strmid(en,7-h,7)
if h=0{gosub *go}:WBYTE px,py,7,"A":redraw 1:await 50:goto *mainloop
//----------------------------------------------------------------------------
*go:redraw 1:locate 11,10:print "GAMEOVER":h=5:WBYTE px,py,7,"A"
*lp:stick st,15,0:if (st and 16)!=0{goto *start}:await 50:goto *lp