Advertisement
Guest User

Untitled

a guest
Oct 7th, 2014
4,531
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.42 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class movetest : MonoBehaviour {
  5.  
  6.     public Vector2 speed = new Vector2(50, 50);
  7.  
  8.     private Vector2 movement;
  9.    
  10.     void Update()
  11.     {
  12.         float inputX = Input.GetAxis("Horizontal");
  13.         float inputY = Input.GetAxis("Vertical");
  14.  
  15.         movement = new Vector2(
  16.             speed.x * inputX,
  17.             speed.y * inputY);
  18.        
  19.     }
  20.    
  21.     void FixedUpdate()
  22.     {
  23.         rigidbody2D.velocity = movement;
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement