coding_giants

l16 - AlienBulletScript

Mar 26th, 2024
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
Add Comment
Please, Sign In to add comment