SHARE
TWEET

Untitled

a guest Jan 24th, 2020 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5.  
  6. public class PlayerController : MonoBehaviour{
  7.  
  8.     private Rigidbody2d rb2d;
  9.  
  10.     void Start()
  11.     {
  12.         rb2d = GetComponant<Rigidbody2d>();
  13.     }
  14.  
  15.  void FixedUpdate()
  16.     {
  17.         float moveHorizontal = Input.GetAxis("Horizontal");
  18.         float moveVertical = Input.GetAxis("Vertical");
  19.         Vector2 movement = new Vector2(moveHorizontal, moveVertical);
  20.         rb2d.AddForce(movement);    
  21.     }
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top