Bullet rain is denser and its bullets are no longer stopped by anything

Interval dropped from 1.0s +- 0.6 to 0.4s +- 0.25 (about 2.5 bullets per second instead of 1), which measured 13 drops in 6 seconds versus 6 before. bullet.gd gained stop_on_obstacle (default false): the probe raycast is disabled, so rain bullets fall straight through terrain and ropes and are only recycled by their lifetime or by dropping past despawn_y. Verified a bullet falling from y=190 goes through the floor at y=225 and despawns at y=340. Also picks up the editor changes: the rope tiles were removed from level 3 and a few nodes gained unique ids.
This commit is contained in:
2026-10-07 23:01:00 +08:00
parent acc7901c2a
commit 8127c787f8
4 changed files with 20 additions and 20 deletions
+7 -7
View File
@@ -1,20 +1,19 @@
extends Node2D
## 子弹雨:从天上随机横坐标往下落子弹,密度可以调得很疏。
## 子弹雨:从天上随机横坐标往下落子弹,密度可以调。
##
## 落下来的子弹撞到地形、或撞到你铺的「绳子/木板桥」就会消失 ——
## 绳子的碰撞放在 TileSet 的第 2 物理层,只有子弹的探针(mask = 3)会检测它,
## 玩家(mask = 1)和钥匙(跟着玩家的 mask)都不受影响,能直接穿过去。
## 落下来的子弹**不会被任何东西挡住**(bullet 的 stop_on_obstacle 默认关掉),
## 会一直穿到关卡底下才回收。
const BULLET := preload("res://scenes/prefabs/enemies/bullet.tscn")
@export var enabled: bool = true
## 平均多少秒落一颗(数值越大越稀疏)
@export var interval: float = 1.0
@export var interval: float = 0.4
## 间隔随机浮动范围(0 = 完全固定节奏)
@export var interval_jitter: float = 0.6
@export var interval_jitter: float = 0.25
## 开场后第一次落下的延迟
@export var start_delay: float = 1.5
@export var start_delay: float = 1.0
## 生成高度(相对自己的 y,负数 = 从屏幕上方外面)
@export var spawn_y: float = -30.0
## 水平撒落范围:以自己的 x 为中心,左右各一半
@@ -56,6 +55,7 @@ func drop() -> void:
bullet.bullet_color = bullet_color
bullet.speed = fall_speed
bullet.damage = damage
bullet.stop_on_obstacle = false
get_parent().add_child(bullet)
bullet.global_position = Vector2(
global_position.x + _rng.randf_range(-span * 0.5, span * 0.5),