From fed245fee27e4f3547947bf8b57f0aff4aa4c71e Mon Sep 17 00:00:00 2001 From: Melon Bread Date: Thu, 16 May 2024 13:42:48 -0400 Subject: [PATCH] Makde the life span of the bullet changeable --- scripts/bullet.gd | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/bullet.gd b/scripts/bullet.gd index 07148d5..7717984 100644 --- a/scripts/bullet.gd +++ b/scripts/bullet.gd @@ -2,11 +2,17 @@ extends Area2D @export var speed := 1400.00 var direction := Vector2.UP +var life_span = 0.5 + +func _ready() -> void: + $LifeTimer.wait_time = life_span func _physics_process(delta: float) -> void: # Movement position += direction.rotated(rotation) * speed * delta + print(rotation) + # Screenwrap var viewport_size := get_viewport_rect().size position.x = wrap(position.x, 0, viewport_size.x)