From 55c2aeac804937f7f14c16068a7fec43ee75cad6 Mon Sep 17 00:00:00 2001 From: Haze Weathers Date: Thu, 1 Jan 2026 17:01:03 -0600 Subject: [PATCH] bullet physics layer --- systems/bullets/bullet.gd | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/systems/bullets/bullet.gd b/systems/bullets/bullet.gd index 178dca1..dfb6092 100644 --- a/systems/bullets/bullet.gd +++ b/systems/bullets/bullet.gd @@ -8,8 +8,8 @@ extends Area2D signal recycled() -## The number of bullets to allocate at startup. -const INITIAL_ALLOCATED_BULLETS: int = 2000 +# ## The number of bullets to allocate at startup. +#const INITIAL_ALLOCATED_BULLETS: int = 2000 ## Texture to draw for the bullet. @@ -39,10 +39,10 @@ const INITIAL_ALLOCATED_BULLETS: int = 2000 ## The amount of time in seconds that the bullet has existed. var time_elapsed: float = 0.0 -## If the bullet has been grazed before +## Whether the bullet has already been grazed by the player. var grazed: bool = false -static var _cached_bullets: Array[Bullet] = [] +#static var _cached_bullets: Array[Bullet] = [] static var _hitbox_shapes: Dictionary[Vector2i, RectangleShape2D] = {} @@ -66,6 +66,7 @@ static func create( bullet.hitbox_size = hitbox_size bullet.direction = direction bullet.face_direction = face_direction + bullet.time_elapsed = 0.0 bullet.grazed = false @@ -82,13 +83,15 @@ func recycle() -> void: recycled.emit() -static func _static_init() -> void: - for _i in INITIAL_ALLOCATED_BULLETS: - _cached_bullets.append(Bullet.new()) +#static func _static_init() -> void: + #for _i in INITIAL_ALLOCATED_BULLETS: + #_cached_bullets.append(Bullet.new()) func _init() -> void: monitoring = false + collision_layer = 1 << 3 + collision_mask = 0 add_to_group(&"bullets") _hitbox.debug_color.a = 0.0 add_child(_hitbox)