View difference between Paste ID: vHpwRU8G and xpN5tp2H
SHOW: | | - or go back to the newest paste.
1
using System.Collections;
2
using System.Collections.Generic;
3
using UnityEngine;
4
5
public class AlienBulletScript : MonoBehaviour
6
{
7
    //bullet speed
8
    public float speed = 6f;
9
    
10
    void Start()
11
    {
12
        //Destroying the bullet after 3 seconds
13
        Destroy(gameObject, 3);
14
    }
15
16
    void Update()
17
    {
18
        Move();
19
    }
20
21
    void Move()
22
    {
23
        //Moving down (along Y axis)
24
        transform.position += Vector3.down * speed * Time.deltaTime;
25
    }
26
27
}