Advertisement
Guest User

Untitled

a guest
Jun 13th, 2014
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.46 KB | None | 0 0
  1. public class PlayerMovement : MonoBehaviour {
  2.     public float speed;
  3.  
  4.     void FixedUpdate()
  5.     {
  6.         float moveHorizontal = Input.GetAxis ("Horizontal");
  7.         float moveVertical = Input.GetAxis ("Vertical");
  8.  
  9.         Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
  10.  
  11.         rigidbody.AddForce (movement * speed * Time.deltaTime);
  12.     }
  13.     void OnTriggerEnter(Collider other)
  14.     {
  15.         if (other.gameObject.tag.Contains ("Wall") == true)
  16.             Application.LoadLevel (0);
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement