ロックマンエグゼみたいに自分(赤床)と敵(青床)それぞれ9マスを移動させたいです
画像1枚目から2枚目のように自分(赤床)のほうの移動操作はできるようになりました。
問題は敵(青床)のほうなんです。やりたいのは9マスの位置に数秒たったらランダムの位置に、数秒たったらランダムの位置に という感じで移動させたいです。何か方法があれば教えてください
ロックマンエグゼみたいに自分(赤床)と敵(青床)それぞれ9マスを移動させたいです
画像1枚目から2枚目のように自分(赤床)のほうの移動操作はできるようになりました。
問題は敵(青床)のほうなんです。やりたいのは9マスの位置に数秒たったらランダムの位置に、数秒たったらランダムの位置に という感じで移動させたいです。何か方法があれば教えてください
Sumimasen, watashi no nihongo wa hurui desu kedo, gambarimasu. koko wa eigo mo ii desu. kono ato wa google translate.
頭に浮かぶ方法は2つあります。
AIに動作ツリーを与え、変数に有効な位置を保存できます。次に、現在の位置に基づいて有効な位置を選択し、新しい位置に移動させるカスタムタスクを作成できます。
あるいは、AIの動きは制限されているので、ブループリントで独自の単純なAI動作を直接作成し、これらの同じ位置チェックを実行できます。
これを試す簡単な方法は、開始時にクラスノードのすべてのアクタを取得してすべての位置を取得し、それらを配列に格納することです。次に、範囲ノードでランダムな整数を使用して、別の位置をランダムに選択できます。
この例では、球はプレイヤーを表しています。
There are two ways off the top of my head I can think of.
you can give the AI a behavior tree and save valid positions to variables. You could then have a custom task that will select a valid position based on where it is currently located and have it move to the new location.
Alternativly, since the AI movement is limited you could create your own simple ai behavior in the blueprint directly and perform these same position checks.
A quick way to try this would be to use a get all actors of class node at start to get all the positions and store them in an array. you could then use a random integer in range node to select a different position at random.
in this example the sphere represents a player.
ありがとうございます!うまくいきました。