迷路ゲーム
投稿者 : 名無し(YahooBB220063240150.bbtec.net)
- 2004/04/25(Sun) 11:07
No.6079
|
|
|
|
|
今、チュートリアルの迷路のように敵が出なくて、複雑な迷路を作りたいと思っているのですが、↓のようにすると、壁じゃないのに止まったり、壁なのに通り抜けてしまったりするのですが、どこをどのようにすれば直りますか?
extends SpriteChar; while (1) { if (getkey(39) && $map.getAt(x+16,y)!=$pat_aiueo+1 ) x+=3; if (getkey(37) && $map.getAt(x-16,y)!=$pat_aiueo+1 ) x-=3; if (getkey(40) && $map.getAt(x+16,y)!=$pat_aiueo+1 ) y+=3; if (getkey(38) && $map.getAt(x-16,y)!=$pat_aiueo+1 ) y-=3; update(); }
|
Re: 迷路ゲーム
投稿者 : napo(eAc1Agv121.tky.mesh.ad.jp)
- 2004/04/25(Sun) 11:42
No.6080
|
|
|
|
if (getkey(40) && $map.getAt(x+16,y)!=$pat_aiueo+1 ) y+=3; if (getkey(38) && $map.getAt(x-16,y)!=$pat_aiueo+1 ) y-=3; の(x+16,y)、(x-16,y)の部分に間違いがあります。 上の文の場合、 「もしも↓が押されていて、なをかつ16ドット右が $pat_aiueo+1では無かったら、下に3ドット移動」となります。 x+16ではなく、y+16にしてみましょう。
|
迷路ゲーム
投稿者 : 名無し(YahooBB220063240150.bbtec.net)
- 2004/04/25(Sun) 14:22
No.6087
|
|
|
|
ありがとうございます。 ↓のようにやってみましたが、左右はうまくいきますが、上下がうまくいきません。どうすればよいでしょうか?
extends SpriteChar; while (1) { if (getkey(39) && $map.getAt(x+16,y)!=$pat_aiueo+1 ) x+=3; if (getkey(37) && $map.getAt(x-16,y)!=$pat_aiueo+1 ) x-=3; if (getkey(40) && $map.getAt(y+16,x)!=$pat_aiueo+1 ) y+=3; if (getkey(38) && $map.getAt(y+16,x)!=$pat_aiueo+1 ) y-=3; update(); }
|
Re: 迷路ゲーム
投稿者 : でぶちん(ntkyto001071.kyto.nt.isdn.ppp.infoweb.ne.jp)
- 2004/04/25(Sun) 15:04
No.6088
|
|
|
|
extends SpriteChar; while (1) { if (getkey(39) && $map.getAt(x+16,y)!=$pat_aiueo+1 ) x+=3; if (getkey(37) && $map.getAt(x-16,y)!=$pat_aiueo+1 ) x-=3; if (getkey(40) && $map.getAt(x,y+16)!=$pat_aiueo+1 ) y+=3; if (getkey(38) && $map.getAt(x,y-16)!=$pat_aiueo+1 ) y-=3; update(); }
ヘルプを見れば大抵分かるはずです。
|
Re: 迷路ゲーム
投稿者 : 名無し(YahooBB220063240150.bbtec.net)
- 2004/04/25(Sun) 15:25
No.6089
|
|
|
|
ありがとうございます! ちゃんと動くようになりました!
|
|