【ゲームエンジン】Unity初心者質問スレBuild1at GAMEDEV【ゲームエンジン】Unity初心者質問スレBuild1 - 暇つぶし2ch■コピペモード□スレを通常表示□オプションモード□このスレッドのURL■項目テキスト479:名前は開発中のものです。 18/08/21 15:11:17.70 8qBPp1CD.net >>457 チュートリアルはroll a ballしかやらなかったな その後は作りたいゲームの案から比較的簡単なやつを選んで作っていった 上達の秘訣はググり力だと思うよ リファレンスを眺めて思いを馳せるのもいいかもしれない 480:名前は開発中のものです。 18/08/24 11:55:13.06 Grbxnj3m.net 敵がプレイヤーに向かってくるスクリプトはできたんだけど敵の進行方向にspriteを左右に反転させるコードがわかりません 分かる方いたらよろしくお願いします。 public class Chase : MonoBehaviour { public GameObject Player; public float Speed; void Update() { this.transform.position = Vector2.MoveTowards(this.transform.position, new Vector2(Player.transform.position.x, Player.transform.position.y), Speed * Time.deltaTime); } } 481:名前は開発中のものです。 18/08/24 12:10:02.41 4yphetVh.net void Update() { Vector3 prePosition = transform.position; this.transform.position = Vector2.MoveTowards(this.transform.position, new Vector2(Player.transform.position.x, Player.transform.position.y), Speed * Time.deltaTime); if(transform.position.x - prePosition.x >= 0){ transform.localScale.x = 1; }else{ transform.localScale.x = -1; } } こんな感じでどう? 2Dやったことないけどねw 次ページ最新レス表示レスジャンプ類似スレ一覧スレッドの検索話題のニュースおまかせリストオプションしおりを挟むスレッドに書込スレッドの一覧暇つぶし2ch