diff --git a/scripts/shoot_component.gd b/scripts/shoot_component.gd index 96a02ee..90b2344 100644 --- a/scripts/shoot_component.gd +++ b/scripts/shoot_component.gd @@ -26,8 +26,8 @@ func _shoot_standard(weapon_data: WeaponShot, current_time: float): var bullet := weapon_data.bullet_scene.instantiate() as Area2D get_tree().root.add_child(bullet) - # Delegate math to the helper, with spawn position offset by sprite height and weapon origin - var spawn_position = ship.global_position + Vector2(0, ship.get_texture().get_height() / 2.0) + weapon_data.origin + # Delegate math to the helper, with spawn position offset by weapon origin + var spawn_position = ship.global_position + weapon_data.origin var props = fire_helper.compute_standard_props(weapon_data, b, spawn_position, current_time) bullet.position = props.position bullet.angle = props.angle @@ -50,7 +50,7 @@ func _shoot_grouped(weapon_data: WeaponShot, current_time: float): get_tree().root.add_child(bullet) # Apply computed properties for the original bullet - var spawn_position = ship.global_position + Vector2(0, ship.get_texture().get_height() / 2.0) + weapon_data.origin + var spawn_position = ship.global_position + weapon_data.origin var props = fire_helper.compute_grouped_props(group, weapon_data, b, spawn_position, current_time, false) bullet.position = props.position bullet.angle = props.angle @@ -66,7 +66,7 @@ func _shoot_grouped(weapon_data: WeaponShot, current_time: float): get_tree().root.add_child(mirror_bullet) # Apply computed properties for the mirrored bullet - var mirror_spawn = ship.global_position + Vector2(0, ship.get_texture().get_height() / 2.0) + weapon_data.origin + var mirror_spawn = ship.global_position + weapon_data.origin var mirror_props = fire_helper.compute_grouped_props(group, weapon_data, b, mirror_spawn, current_time, true) mirror_bullet.position = mirror_props.position mirror_bullet.angle = mirror_props.angle diff --git a/scripts/weapon_fire_helper.gd b/scripts/weapon_fire_helper.gd index b5a080d..5d7b788 100644 --- a/scripts/weapon_fire_helper.gd +++ b/scripts/weapon_fire_helper.gd @@ -15,9 +15,11 @@ func compute_standard_props(weapon_data: WeaponShot, projectile_index: int, spaw # Timing: center-first, pairs outward var time_offset: float = abs(index_from_center) * weapon_data.stagger_offset - # Vertical offset: outer projectiles are spaced relative to center, preserving the pattern geometry. + # Vertical spacing creates the ^ (inverted-V) geometry: outer projectiles fire higher + # than the center projectile. Negate the offset so outer bullets are pushed upward + # (lower y values in Godot), creating a ^ pattern relative to the origin. var vertical_offset: float = (abs(index_from_center) * weapon_data.projectile_vertical_spacing) / 2.0 - var position: Vector2 = spawn_position + Vector2(bullet_horizontal_offset, vertical_offset) + var position: Vector2 = spawn_position + Vector2(bullet_horizontal_offset, -vertical_offset) # Angle (only when projectiles >= 3, division-by-zero guard) var bullet_angle: float = 0.0 diff --git a/scripts/weapon_shot.gd b/scripts/weapon_shot.gd index 1cc91ea..66c946b 100644 --- a/scripts/weapon_shot.gd +++ b/scripts/weapon_shot.gd @@ -7,9 +7,18 @@ extends Resource @export var damage: int = 1 @export var speed: int = 135 @export var projectiles: int = 2 -# Vertical spacing between projectiles when firing continuously +# Vertical spacing between projectiles in a burst (used by WeaponFireHelper to compute the ^ pattern). +# This controls spatial burst geometry, NOT temporal spacing between continuous fire bursts. @export var projectile_vertical_spacing: float = 35 -# Spawn offset from center of player (x is usually 0, y controls vertical fire position) +# Spawn offset strictly relative to the ship node's global position (origin). +# This offset is measured from the ship node's center, not the sprite texture. +# x is usually 0 (horizontal centering), y controls vertical fire position. +# Negative Y moves bullets "above" the ship (in front of it); positive Y +# moves them "below" (behind it). The default of (0, -25) places the burst +# 25 pixels above (in front of) the ship center. +# All weapon resources in this project use the default. Custom weapons with +# explicit origin.y > 0 (positive) will have their burst pattern appear +# behind or below the ship -- verify visually if adjusting. @export var origin: Vector2 = Vector2(0, -25) @export_category("Spread")