Playerの作成1(左右に動かす)


Playerを左右に動かす
using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerMovement : MonoBehaviour { public float speed; void Start() { } void Update() { float moveH = Input.GetAxisRaw("Horizontal"); Vector2 movement = new Vector2(moveH, 0); transform.Translate(movement * Time.deltaTime * speed); } }
C#


【2022版】ActionGame2D(全33回)
他のコースを見る

Playerを左右に動かす
using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerMovement : MonoBehaviour { public float speed; void Start() { } void Update() { float moveH = Input.GetAxisRaw("Horizontal"); Vector2 movement = new Vector2(moveH, 0); transform.Translate(movement * Time.deltaTime * speed); } }
C#


Playerの作成1(左右に動かす)