*home
randomize;いつもランダム
buffer 100,10,10
picload "nur.bmp"
buffer 1,10,10
picload "boka.bmp"
buffer 2,10,10
picload "kyara.bmp"
buffer 3,10,10
picload "hara.bmp"
*top
screen 0,510,510,0,10,10
dim map,510,510
dim haraa,510,510
dim harab,510,510
haraax = 0:haraay = 0
harabx = 0:haraby = 0
harax = 0
haray = 0
repeat 51
repeat 51
pos harax,haray
gcopy 3,0,0,10,10
harax + 10
loop
haray + 10
harax = 0
loop
repeat 3
haraay + 10
repeat 3
haraax + 10
pos haraax,haraay
gcopy 3,10,0,10,10
haraa(haraax,haraay) = 5
loop
haraax = 0
loop
haraax = 460
haraay = 460
repeat 3
haraay + 10
repeat 3
haraax + 10
pos haraax,haraay
gcopy 3,10,0,10,10
haraa(haraax,haraay) = 5
loop
haraax = 460
loop
harabzzx = 490:harabzzy = 490
pos harabzzx,harabzzy
gcopy 3,0,10,10,10
harab(harabzzx,harabzzy) = 5
////////////////////////////壁ブロックの作成
ccx = 0
ccy = 0
repeat
pos ccx,ccy
gcopy 1,0,0,10,10
map(ccx,ccy) = 5
if ccx = 500 {
break
}
ccx +10
loop
ccy + 10
repeat
pos ccx,ccy
gcopy 1,0,0,10,10
map(ccx,ccy) = 5
if ccy = 500 {
break
}
ccy +10
loop
ccx - 10
repeat
pos ccx,ccy
gcopy 1,0,0,10,10
map(ccx,ccy) = 5
if ccx = 0 {
break
}
ccx - 10
loop
ccy - 10
repeat
pos ccx,ccy
gcopy 1,0,0,10,10
map(ccx,ccy) = 5
if ccy = 10 {
break
}
ccy - 10
loop
////////////////////////////壁ブロックの作成ここまで
ccx = 0
ccy = 0
////////////////////////////内部壁ブロック作成
repeat
if ccy = 480{
break
}
ccy + 20
repeat
if ccx = 480{
break
}
ccx + 20
pos ccx,ccy
gcopy 1,0,0,10,10
map(ccx,ccy) = 5
loop
ccx = 0
loop
;break
////////////////////////////内部壁ブロック作成ここまで
ccvvx = 0
ccvvy = 0
ccdf = 0;4つの乱数の発生
////////////////////////////迷路の作成
repeat
if ccvvy = 480{
break
}
ccvvy + 20
repeat
if ccvvx = 480{
break
}
ccvvx + 20
*lopa
ccdf = rnd(4)+1
//------
if ccdf = 1 {
ccx = ccvvx + 10
ccy = ccvvy
if map(ccx,ccy){
goto *lopa
}
pos ccx,ccy
gcopy 1,0,0,10,10
map(ccx,ccy) = 5
}
//------
if ccdf = 2 {
ccx = ccvvx
ccy = ccvvy + 10
if map(ccx,ccy){
goto *lopa
}
pos ccx,ccy
gcopy 1,0,0,10,10
map(ccx,ccy) = 5
}
//------
if ccdf = 3 {
ccx = ccvvx - 10
ccy = ccvvy
if map(ccx,ccy){
goto *lopa
}
pos ccx,ccy
gcopy 1,0,0,10,10
map(ccx,ccy) = 5
}
//------
if ccdf = 4 {
ccx = ccvvx
ccy = ccvvy - 10
if map(ccx,ccy){
goto *lopa
}
pos ccx,ccy
gcopy 1,0,0,10,10
map(ccx,ccy) = 5
}
//------
;wait 2
loop
ccvvx = 0
loop
////////////////////////////迷路の作成ここまで
////////////////////////////キャラ操作
////
kyarax = 70
kyaray = 70
kyararnd = 0
kyarabx = 50
kyaraby = 50
kyaracx = 90
kyaracy = 90
cntkyaraa = 0
kyarasuua = 20;キャラ数
kkx = 10
kky = 10
brkx = 100
pos kkx, kky ;カレントポジション設定
gcopy 2, 0, 0 ,10,10
repeat
redraw 0
;boxf
;画像コピー
stick key, 15 ;キー入力
if key & 1 {;左
kkx = kkx - 10
if map(kkx,kky){
kkx + 10
}
else{
pos kkx+10,kky
gcopy 3, 0, 0,10,10
pos kkx, kky
gcopy 2, 0, 0 ,10,10
}
}
if key & 2 {
kky = kky - 10
if map(kkx,kky){
kky + 10
}
else{
pos kkx,kky+10
gcopy 3, 0, 0,10,10
pos kkx, kky ;カレントポジション設定
gcopy 2, 0, 0 ,10,10
}
};上
if key & 4 {
kkx = kkx + 10
if map(kkx,kky){
kkx - 10
}
else{
pos kkx-10,kky
gcopy 3, 0, 0,10,10
pos kkx, kky ;カレントポジション設定
gcopy 2, 0, 0 ,10,10
}
}
if key & 8 {
kky = kky + 10
if map(kkx,kky){
kky - 10
}
else{
pos kkx,kky-10
gcopy 3, 0, 0,10,10
pos kkx, kky ;カレントポジション設定
gcopy 2, 0, 0 ,10,10
}
}
if key & 128 : break ;[Esc]
if (kyarax = kkx and kyaray = kky) or (kyarabx = kkx and kyaraby = kky) or (kyaracx = kkx and kyaracy = kky){
end
}
if harab(kkx,kky){
break
}
*kyarassa
kyararnda = rnd(4)+1
//----
if kyararnda = 1 {
kyarax + 10
if map(kyarax,kyaray) or haraa(kyarax,kyaray){
kyarax - 10
goto *kyarassa
}else{
pos kyarax-10,kyaray
gcopy 3,0,0,10,10
pos kyarax,kyaray
gcopy 2, 10, 0 ,10,10
}
}
//----
if kyararnda = 2 {
kyaray + 10
if map(kyarax,kyaray) or haraa(kyarax,kyaray){
kyaray - 10
goto *kyarassa
}else{
pos kyarax,kyaray-10
gcopy 3,0,0,10,10
pos kyarax,kyaray
gcopy 2, 10, 0 ,10,10
}
}
//----
if kyararnda = 3 {
kyarax - 10
if map(kyarax,kyaray) or haraa(kyarax,kyaray){
kyarax + 10
goto *kyarassa
}else{
pos kyarax+10,kyaray
gcopy 3,0,0,10,10
pos kyarax,kyaray
gcopy 2, 10, 0 ,10,10
}
}
//----
if kyararnda = 4 {
kyaray - 10
if map(kyarax,kyaray) or haraa(kyarax,kyaray){
kyaray + 10
goto *kyarassa
}
else{
pos kyarax,kyaray+10
gcopy 3,0,0,10,10
pos kyarax,kyaray
gcopy 2, 10, 0 ,10,10
}
}
//----
kyararndb = rnd(4)+1
//----
if kyararndb = 1 {
kyarabx + 10
if map(kyarabx,kyaraby) or haraa(kyarabx,kyaraby){
kyarabx - 10
}else{
pos kyarabx-10,kyaraby
gcopy 3,0,0,10,10
pos kyarabx,kyaraby
gcopy 2, 20, 0 ,10,10
}
}
//----
if kyararndb = 2 {
kyaraby + 10
if map(kyarabx,kyaraby) or haraa(kyarabx,kyaraby){
kyaraby - 10
}else{
pos kyarabx,kyaraby-10
gcopy 3,0,0,10,10
pos kyarabx,kyaraby
gcopy 2, 20, 0 ,10,10
}
}
//----
if kyararndb = 3 {
kyarabx - 10
if map(kyarabx,kyaraby) or haraa(kyarabx,kyaraby){
kyarabx + 10
}else{
pos kyarabx+10,kyaraby
gcopy 3,0,0,10,10
pos kyarabx,kyaraby
gcopy 2, 20, 0 ,10,10
}
}
//----
if kyararndb = 4 {
kyaraby - 10
if map(kyarabx,kyaraby) or haraa(kyarabx,kyaraby){
kyaraby + 10
}
else{
pos kyarabx,kyaraby+10
gcopy 3,0,0,10,10
pos kyarabx,kyaraby
gcopy 2, 20, 0 ,10,10
}
}
//----
*kyarac
if rndkyarac = 0{
kyararndc = rnd(4)+1
}
rndkyarac = 1
//----
if kyararndc = 1 {
kyaracx + 10
if map(kyaracx,kyaracy) or haraa(kyaracx,kyaracy){
kyaracx - 10
rndkyarac = 0
goto *kyarac
}else{
pos kyaracx-10,kyaracy
gcopy 3,0,0,10,10
pos kyaracx,kyaracy
gcopy 2, 0, 10 ,10,10
}
}
//----
if kyararndc = 2 {
kyaracy + 10
if map(kyaracx,kyaracy) or haraa(kyaracx,kyaracy){
kyaracy - 10
rndkyarac = 0
goto *kyarac
}else{
pos kyaracx,kyaracy-10
gcopy 3,0,0,10,10
pos kyaracx,kyaracy
gcopy 2, 0, 10 ,10,10
}
}
//----
if kyararndc = 3 {
kyaracx - 10
if map(kyaracx,kyaracy) or haraa(kyaracx,kyaracy){
kyaracx + 10
rndkyarac = 0
goto *kyarac
}else{
pos kyaracx+10,kyaracy
gcopy 3,0,0,10,10
pos kyaracx,kyaracy
gcopy 2, 0, 10 ,10,10
}
}
//----
if kyararndc = 4 {
kyaracy - 10
if map(kyaracx,kyaracy) or haraa(kyaracx,kyaracy){
kyaracy + 10
rndkyarac = 0
goto *kyarac
}
else{
pos kyaracx,kyaracy+10
gcopy 3,0,0,10,10
pos kyaracx,kyaracy
gcopy 2, 0, 10 ,10,10
}
}
//----
redraw 1
wait 2
loop
////////////////////////////キャラ操作ここまで
goto *top
*むちゃくちゃなコードですみません^p^
このコードを何回か実行すると途中で無限ループにはまってしまうようなのですが、どこが異常なのかわかりません
どうやって修復したらいいのか教えて下さい。
http://be-sp.com/7909pp7/home/kousyoukai/joyful/img/105.zip
↑画像ファイル