using UnityEngine;
using System.Collections;

public class JumpBotMovement : MonoBehaviour
{
    public GameObject target;
    public float Speed;

	AudioSource scream;

    void Start()
    {
		scream = GetComponent<AudioSource> ();
    }

    // Update is called once per frame
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.gameObject == target)
        {
            float anglerad2 = Mathf.Atan2(target.transform.position.y - transform.position.y, target.transform.position.x - transform.position.x);
            float angledeg2 = (180 / Mathf.PI) * anglerad2;
            transform.rotation = Quaternion.Euler(0, 0, angledeg2);
        	transform.Translate(Speed, 0, 0);
			scream.Play ();
        }

    }
}