using UnityEngine;
using System.Collections;

public class Splash : MonoBehaviour {
    public float speed;
    public float alphaSpeed;
    private SpriteRenderer sprite;

	// Use this for initialization
	void Start () {
        sprite = GetComponent<SpriteRenderer>();
	}
	
	// Update is called once per frame
	void Update () {
        transform.position = transform.position + Vector3.left * speed * Time.deltaTime;
        sprite.color = new Color(sprite.color.r, sprite.color.g, sprite.color.b, sprite.color.a - alphaSpeed * Time.deltaTime);
        

        if (transform.position.x < -20 || sprite.color.a <= 0)
            Destroy(gameObject);
	}
}
