aboutsummaryrefslogtreecommitdiffstats
path: root/Assets/Scripts/Projectile.cs
blob: b07958bf431c22d00717d73d3d01c6e444faa02f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MontanaJohns.Actors;

public class Projectile : MonoBehaviour
{
    public float speed = 60f;
    public Rigidbody2D rb;

    // Start is called before the first frame update
    private void Start()
    {
        rb.velocity = transform.right * speed;
    }

    private void Update()
    {
        Destroy(gameObject, 4f);
    }

    private void OnCollisionEnter2D(Collision2D collision)
    {
        Destroy(gameObject);
    }
}