HSPポータル
サイトマップ お問い合わせ


HSPTV!掲示板


未解決 解決 停止 削除要請

2014
0721
<preRPGもどきを作りたいんですが...3解決


<pre

リンク

2014/7/21(Mon) 13:31:21|NO.63009


screen 440,640 dim map,15,12 map(0,0)=0,0,0,0,0,0,0,0,0,0,0,0 map(0,1)=0,0,0,0,0,0,0,0,0,0,0,0 map(0,2)=0,0,0,0,0,0,0,0,0,0,0,0 map(0,3)=0,0,0,0,0,0,0,0,0,0,0,0 map(0,4)=0,0,0,0,0,0,0,0,0,0,0,0 map(0,5)=0,0,0,0,0,0,0,0,0,0,0,0 map(0,6)=0,0,0,0,0,0,0,0,0,0,0,0 map(0,7)=0,0,0,0,0,0,0,0,0,0,0,0 map(0,8)=0,0,0,0,0,0,0,0,0,0,0,0 map(0,9)=0,0,0,0,0,0,0,0,0,0,0,0 map(0,10)=0,0,0,0,0,0,0,0,0,0,0,0 map(0,11)=0,0,0,0,0,0,0,0,0,0,0,0 message="" *main x=0:y=0 cls redraw 0 repeat 12 repeat 13 if map(i,j)=0:color 0,255,0 if map(i,j)=1:color 241, 187, 147 boxf x,y,x+40,y+40 x += 40 i=cnt loop x = 0 y += 40 j=cnt loop color repeat 13 boxf 40*(cnt+1),0,40*(cnt+1),480 loop repeat 12 boxf 0,40*(cnt+1),640,40*(cnt+1) loop pos 480,0 mesbox message,160,480,4 redraw 1 await 1 goto*main
0=草原
1=砂地
のはずなんですが、なぜか場所がズレてしまいます。
なぜでしょうか?



この記事に返信する


Ve

リンク

2014/7/21(Mon) 14:12:21|NO.63012

初期化できてない&変数”j”の代入間違ってる。


*main x=0:y=0 cls redraw 0 i=0 j=0 repeat 12 repeat 13 if map(i,j)=0:color 0,255,0 if map(i,j)=1:color 241, 187, 147 boxf x,y,x+40,y+40 x += 40 i=cnt loop x = 0 y += 40 j++ loop



たんす

リンク

2014/7/21(Mon) 14:30:03|NO.63014

ループの終わりにi=cntで代入されているので、
マップ判定i,jと描画座標x,yがそこでずれています。

repeat 12
j=cnt //先に代入しておく repeat 13 i=cnt //先に代入しておく if map(i,j)=0:color 0,255,0 //草地 if map(i,j)=1:color 241, 187, 147 //砂地 boxf x,y,x+40,y+40 x += 40 ; i=cnt loop x = 0 y += 40 ;j=cnt loop



<pre

リンク

2014/7/21(Mon) 15:36:16|NO.63015

うおおう
ありです



ONION software Copyright 1997-2023(c) All rights reserved.