【2D】ゲーム作成ツールGameMaker part3【マンセー】at GAMEDEV
【2D】ゲーム作成ツールGameMaker part3【マンセー】 - 暇つぶし2ch15:名前は開発中のものです。
08/05/11 23:56:50 AX4c16UA
スプライト8枚じゃなくて、1枚のスプライトでサブイメージ8枚にする
(1番目が右向き、2番目が右上、3番目が上、……と0°から反時計回りに並べる)
で、Stepイベントで
image_singe = point_direction(x, y, mouse_x, mouse_y) / 45
と設定すればいけるはずだけど。
(厳密に言えば、image_singleはGM6以降では廃止されているので、
image_indexを設定してimage_speedを0にするのが正しい)

ちなみにどうしてもスプライト別々でやりたいなら、
変数を一つ設定しておいて
set the variable direction to point_direction(x, y, mouse_x, mouse_y)
if expression (direction < 22.5 || direction >= 337.5) is true // 8角形に「?」のアイコンを使う
set the sprite (右向きのスプライト)
if expression (direction >= 22.5 && direction < 67.5) is true
set the sprite (右上のスプライト)
if expression (direction >= 67.5 && direction < 112.5) is true
set the sprite (上向きのスプライト)
……(中略)
if expression (direction >= 292.5 && direction < 337.5) is true
set the sprite (右下のスプライト)

みたいな感じに判定していく。ここまでくるとGML書いてるのとあまり変わらんけど、
アクションだと複数条件の組み合わせはうまく表現できないからね。


次ページ
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch