Skip to content

Instantly share code, notes, and snippets.

@h1g0
Created August 28, 2019 16:13
Show Gist options
  • Save h1g0/a6b42006f34d063a0d1df2ee5b329bc0 to your computer and use it in GitHub Desktop.
Save h1g0/a6b42006f34d063a0d1df2ee5b329bc0 to your computer and use it in GitHub Desktop.
昔SPALMという言語用に書いたゲームをSPALM Web Interpreter( https://hamayapp.appspot.com/static/sp_interpreter.html )用に少し調整したゲーム
soft1("終了")
setfont("S")
ca=-90
cx=width/2
cy=160
bc=4
hc=0
pc=0
lc=5
s=0
@(bx,cx,cx,cx,cx,cx)
@(by,cy,cy,cy,cy,cy)
col(0xF0F0F0)
frect(0,160,width,height)
col(0xFFFFFF)
farc(width/2-70,170,140,140)
col(0xF0F0F0)
farc(width/2-35,205,70,70)
col(0x606060)
text("MENU",cx,190,HCENTER|BASELINE)
text("|<<",width/2-55,245,HCENTER|BASELINE)
text(">>|",width/2+55,245,HCENTER|BASELINE)
start()
while(scan!=131072){
i=0
if((scan&16)||(scan&8192)){ca=max(ca-10,-180)}
if((scan&64)||(scan&16384)){ca=min(ca+10,0)}
if((scan&32)||(scan&65536)){
while(i<=bc){
if(bf[i]==0){
bi=i
bf[i]=1
bxp[i]=cos(ca)*5
byp[i]=sin(ca)*5
s--
break
}
i++
}
}
gx=cx+cos(ca)*15
gy=cy-5+sin(ca)*15
hi=0
while(hi<=hc){
if(hf[hi]==0){
if(abs(rand%30)==3){
hf[hi]=1
hy[hi]=abs(rand%60)+20
if(abs(rand%2)==0){
hv[hi]=0
hx[hi]=0
}else{
hv[hi]=1
hx[hi]=width
}
}
}
hi++
}
lock()
col(0x00DDDD)
frect(0,0,width,160)
col(0x606060)
text("■",cx,cy,HCENTER|BASELINE)
line(cx,cy-5,gx,gy)
j=0
while(j<=bc){
if(bf[j]==1){
bx[j]=bx[j]+bxp[j]
by[j]=by[j]+byp[j]
if(bx[j]<0||by[j]<0||bx[j]>width||by[j]>160){
bf[j]=0bx[j]=cx
by[j]=cy
}else{
text("・",bx[j],by[j],HCENTER|BASELINE)
}
}
j++
}
hj=0
while(hj<=hc){
if(hf[hj]==1){
pi1=0
while(pi1<=pc){
if(pf[pi1]==0){
if(abs(rand%30)==5){
pf[pi1]=1
px[pi1]=hx[hj]
py[pi1]=hy[hj]
}
}
pi1++
}
if(hv[hj]==0){
hx[hj]=hx[hj]+5
if(hx[hj]>width){hf[hj]=0}else{
hi2=0
while(hi2<=bc){
if(bf[hi2]==1){
if(pow(hx[hj]-bx[hi2],2)+pow(hy[hj]-by[hi2],2)<=400){
text("💥",hx[hj],hy[hj],HCENTER|BASELINE)
hf[hj]=0
bxp[hi2]=20
byp[hi2]=20
s=s+3
break
}else{
text("┗古",hx[hj],hy[hj],HCENTER|BASELINE)
}
}else{
text("┗古",hx[hj],hy[hj],HCENTER|BASELINE)
}
hi2++
}
}
}else{
hx[hj]=hx[hj]-3
if(hx[hj]<0){
hf[hj]=0
}else{
hj2=0
while(hj2<=bc){
if(bf[hj2]==1){
if(pow(hx[hj]-bx[hj2],2)+pow(hy[hj]-by[hj2],2)<=400){
text("💥",hx[hj],hy[hj],HCENTER|BASELINE)
hf[hj]=0
bxp[hj2]=-20
byp[hj2]=20
s=s+3
break
}else{
text("古┛",hx[hj],hy[hj],HCENTER|BASELINE)
}
}else{
text("古┛",hx[hj],hy[hj],HCENTER|BASELINE)
}
hj2++
}
}
}
}
hj++
}
pj=0
while(pj<=pc){
if(pf[pj]==1){
py[pj]=py[pj]+1
if(py[pj]>=cy-5){
li++
lx[li]=px[pj]
pf[pj]=0
}
pi2=0
while(pi2<=bc){
if(bf[pi2]==1&&pow(px[pj]-bx[pi2],2)+pow(py[pj]-by[pi2],2)<=200){
text("💥",px[pj],py[pj],HCENTER|BASELINE)
pf[pj]=0
bf[pi2]=0
bx[pi2]=cx
by[pi2]=cy
s=s+2
break
}else{
text("☂",px[pj],py[pj],HCENTER|BASELINE)
}
pi2++
}
}
pj++
}
lj=1
while(lj<=li){
text("🚶",lx[lj],cy,HCENTER|BASELINE)
lj++
}
if(li>=lc){
gover()
break
}
if(s<0){
s=0
}
hc=s/20+1
pc=hc+2
col(0xFF0000)
text("Score:".s,10,20,LEFT|BASELINE)
unlock(1)
sleep(100)
}
func start(){
col(0x00DDDD)
frect(0,0,width,160)
col(0x808080)
text("Parachute",width/2+2,52,HCENTER|BASELINE)
col(0x004400)
text("┗古 Parachute 古┛",width/2,50,HCENTER|BASELINE)
col(0x000000)
text("Turn Left: 4 Key",width/2,70,HCENTER|BASELINE)text("FIRE!: 5 Key",width/2,85,HCENTER|BASELINE)
text("Turn Right: 6 Key",width/2,100,HCENTER|BASELINE)
col(0xFF0000)
text("High Score:".load(),width/2,120,HCENTER|BASELINE)
text("Press Any Key To Start",width/2,140,HCENTER|BASELINE)
input()
}
func gover(){
hs=load()
text("💥",cx,cy,HCENTER|BASELINE)
col(0x005500)
text("GAME OVER",cx,80,HCENTER|BASELINE)
col(0x000000)
text("Your Score:".s,cx,100,HCENTER|BASELINE)
if(s>hs){
save(s)
col(0xFF0000)
text("High Score!",cx,115,HCENTER|BASELINE)
}
unlock(1)
clearkey()
input()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment