space_shooter/Assets/Scripts/Bullet.cs
2025-02-28 22:42:44 +05:30

25 lines
478 B
C#

using UnityEngine;
public class Bullet : MonoBehaviour
{
public float Speed = 0.5f;
float timer;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
}
// Update is called once per frame
void Update()
{
transform.Translate(new Vector3(0,Speed,0));
timer += Time.deltaTime;
if(timer > 2)
{
Destroy(gameObject);
}
}
}