using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;
public class main : MonoBehaviour{

  public float range,ihorizm,ivertm;
  public Text textOutput1,textOutput2,textOutput3,textOutput4;
  public int hgarbage1,vgarbage1,keybd,ubaxis,counter,counter2,xpos,ypos,xyspeed,xoff,yoff;
  public GameObject sprite1;

  void Start(){
    counter=0;xpos=450;ypos=250;xyspeed=8;xoff=-360;yoff=-225;
    }

  void Update (){

    float ihoriz=Input.GetAxis("Horizontal");
    float ivert=Input.GetAxis("Vertical");
    hgarbage1=0;ubaxis=0;
    if (ihoriz<0){hgarbage1=-1;ubaxis+=1;xpos-=xyspeed;}
    if (ihoriz>0){hgarbage1=1;ubaxis+=2;xpos+=xyspeed;}
    if (ivert<0){vgarbage1=-1;ubaxis+=8;ypos+=xyspeed;}
    if (ivert>0){vgarbage1=1;ubaxis+=4;ypos-=xyspeed;}

    if (xpos<-0){xpos=0;}
    if (xpos>720){xpos=720;}
    if (ypos<0){ypos=0;}
    if (ypos>450){ypos=450;}

    keybd=0;
    if (Input.GetKey(KeyCode.UpArrow)){keybd+=4;}
    if (Input.GetKey(KeyCode.DownArrow)){keybd+=8;}
    if (Input.GetKey(KeyCode.LeftArrow)){keybd+=1;}
    if (Input.GetKey(KeyCode.RightArrow)){keybd+=2;}
    if (Input.GetKey(KeyCode.Z)){keybd+=16;}
    if (Input.GetKey(KeyCode.X)){keybd+=32;}
    if (Input.GetKey(KeyCode.C)){keybd+=64;}
    if (Input.GetKey(KeyCode.V)){keybd+=128;}
    //if (Input.GetKey(JoystickButton0)){keybd+=256;}

    counter2=(counter/50)%1000;

    float xPos=ihoriz*range;float yPos=ivert*range;
    transform.position=new Vector3(xPos,yPos,0);
    textOutput1.text="GetAxis: "+ubaxis.ToString("F0");
    textOutput2.text="GetKey: "+keybd.ToString("F0");
    textOutput3.text=xpos.ToString("F0")+","+ypos.ToString("F0");
    textOutput4.text=counter2.ToString("F0");

    sprite1.transform.position = new Vector2(xpos+xoff,(ypos+yoff)*-1);
    counter+=1;

    }}





