Untitled
unknown
csharp
a year ago
650 B
6
Indexable
Never
using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerMovement : MonoBehaviour { public int movespeed; public Rigidbody2D rb; private void Start() { rb = gameObject.GetComponent<Rigidbody2D>(); } private void Update() { Move(); } private void Move() { var velocityHor = Input.GetAxis("Horizontal"); var velocityVer = Input.GetAxis("Vertical"); Debug.Log("yatay degerim: " + velocityHor); Debug.Log("dikey degerim: " + velocityVer); rb.velocity = new Vector2(velocityHor, velocityVer) * movespeed; } }