#define box(%1,%2) boxf %1,%2,%1+mx,%2+my
mapsx=30:mapsy=30
dim map,mapsx,mapsy
dim atari,mapsx+1,mapsy+1
mx=16
my=16
CharSpeed=1
//HitCode
at={"
000000000000000000000000000000
000000000000000000000000000000
000000000000000000000000000000
000100010011110011110000000000
000100010010000010010000000000
000100010010000010010000000000
000111110011110011110000000000
000100010000010010000000000000
000100010000010010000000000000
000100010011110010000000000000
000000000000000000000000000000
000000000000000000000000000000
000001111111111111111111000000
000000000000000000000001000000
000001111111111111110001000000
000000100000100000000001000000
000000100000111111100001111000
000000100000000000000000001000
000000101111111111100000001000
000000101000000000000001001000
000000111010000000111111001000
001011100011111000100000001000
001000000000000000100001001000
001001111111111111100001001000
001001000000000000101111001000
001001000000000000000000001000
000001001111111111111111111000
111111001000000000000000000000
100000001000000000000000000000
111111111000000000000000000000
"}
repeat mapsx*mapsy
//改行
if peek(at,cc)=13{
if peek(at,cc+1)=10{
cc+2
ycnt+
xcnt=0
}
}
if peek(at,cc)=49{
atari.xcnt.ycnt=1
}
xcnt+
cc+
loop
*mainloop
Redraw 0
//ClearCode
color 255,255,255 : box mx*px, my*py
//MainCharCode
repeat 4
loop
if atari.limit(px-1,0,mapsx).limit(py,0,mapsy)=0 : getkey key,37 : if key:px-CharSpeed
if atari.limit(px,0,mapsx).limit(py-1,0,mapsy)=0 : getkey key,38 : if key:py-CharSpeed
if atari.limit(px+1,0,mapsx).limit(py,0,mapsy)=0 : getkey key,39 : if key:px+CharSpeed
if atari.limit(px,0,mapsx).limit(py+1,0,mapsy)=0 : getkey key,40 : if key:py+CharSpeed
//DrawCode
color 255
repeat mapsy
mcnt=cnt
repeat mapsx
if atari.cnt.mcnt{
box mx*cnt, my*mcnt
}
loop
loop
color : box mx*px, my*py
Redraw 1
await 50
goto *mainloop