Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class movetest : MonoBehaviour {
- public Vector2 speed = new Vector2(50, 50);
- private Vector2 movement;
- void Update()
- {
- float inputX = Input.GetAxis("Horizontal");
- float inputY = Input.GetAxis("Vertical");
- movement = new Vector2(
- speed.x * inputX,
- speed.y * inputY);
- }
- void FixedUpdate()
- {
- rigidbody2D.velocity = movement;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement