Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class SpriteMover : MonoBehaviour {
- // Use this for initialization
- void Start () {
- }
- // Update is called once per frame
- void Update () {
- {
- if ((Input.GetKey(KeyCode.LeftShift)))
- {
- if(Input.GetKeyDown(KeyCode.LeftArrow)){
- Vector3 position = this.transform.position;
- position.x--;
- this.transform.position = position;
- }
- if(Input.GetKeyDown(KeyCode.RightArrow)){
- Vector3 position = this.transform.position;
- position.x++;
- this.transform.position = position;
- }
- if(Input.GetKeyDown(KeyCode.UpArrow)){
- Vector3 position = this.transform.position;
- position.y++;
- this.transform.position = position;
- }
- if(Input.GetKeyDown(KeyCode.DownArrow)){
- Vector3 position = this.transform.position;
- position.y--;
- this.transform.position = position;
- }
- } else {
- if (Input.GetKey(KeyCode.LeftArrow)) {
- Vector3 position = this.transform.position;
- position.x--;
- this.transform.position = position;
- }
- if (Input.GetKey(KeyCode.RightArrow)) {
- Vector3 position = this.transform.position;
- position.x++;
- this.transform.position = position;
- }
- if (Input.GetKey(KeyCode.UpArrow)) {
- Vector3 position = this.transform.position;
- position.y++;
- this.transform.position = position;
- }
- if (Input.GetKey(KeyCode.DownArrow)) {
- Vector3 position = this.transform.position;
- position.y--;
- this.transform.position = position;
- }
- }
- if ((Input.GetKey(KeyCode.RightShift)))
- {
- if(Input.GetKeyDown(KeyCode.LeftArrow)){
- Vector3 position = this.transform.position;
- position.x--;
- this.transform.position = position;
- }
- if(Input.GetKeyDown(KeyCode.RightArrow)){
- Vector3 position = this.transform.position;
- position.x++;
- this.transform.position = position;
- }
- if(Input.GetKeyDown(KeyCode.UpArrow)){
- Vector3 position = this.transform.position;
- position.y++;
- this.transform.position = position;
- }
- if(Input.GetKeyDown(KeyCode.DownArrow)){
- Vector3 position = this.transform.position;
- position.y--;
- this.transform.position = position;
- }
- } else {
- if (Input.GetKey(KeyCode.LeftArrow)) {
- Vector3 position = this.transform.position;
- position.x--;
- this.transform.position = position;
- }
- if (Input.GetKey(KeyCode.RightArrow)) {
- Vector3 position = this.transform.position;
- position.x++;
- this.transform.position = position;
- }
- if (Input.GetKey(KeyCode.UpArrow)) {
- Vector3 position = this.transform.position;
- position.y++;
- this.transform.position = position;
- }
- if (Input.GetKey(KeyCode.DownArrow)) {
- Vector3 position = this.transform.position;
- position.y--;
- this.transform.position = position;
- }
- }
- if (Input.GetKey (KeyCode.Space))
- {
- this.transform.position = new Vector3 (0f, 0f, 0f);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement