SebastianLawe

Untitled

Apr 17th, 2015
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.35 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class Movement : MonoBehaviour {
  5.  
  6.  float speed = 1.0f;
  7.  Rigidbody2D playerRigidbody;
  8.  
  9.  void Start(){
  10.   playerRigidbody = GetComponent<Rigidbody2D>();
  11.  }
  12.  void Update() {
  13.   playerRigidbody.AddForce(new Vector2(Input.GetAxis("Horizontal") * speed, Input.GetAxis("Vertical") * speed));
  14.  }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment