using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//public float coordenada;
//public float coordenadax;
//public float coordenaday;


public class movesprite1:MonoBehaviour{
  //public Vector2 coordenada1;
  public Vector2 speed=new Vector2(5f,5f);                                           // 1 - The speed of the ship
  public Vector2 movement;                                                          // 2a - Store the movement
  public Rigidbody2D rigidbodyComponent;                                            // 2b - Store the component
  void Update(){
    float inputX=Input.GetAxis("Horizontal");float inputY=Input.GetAxis("Vertical"); // 3 - Retrieve axis information
    movement=new Vector2(speed.x*inputX,speed.y*inputY);                             // 4 - Movement per direction
    //coordenada1=rigidbodyComponent.position;
    }
  void FixedUpdate(){
    if (rigidbodyComponent==null) rigidbodyComponent=GetComponent<Rigidbody2D>();    // 5 - Get the component and store the reference
    rigidbodyComponent.velocity=movement;}}                                          // 6 - Move the game object

