Still a lille buggy! But closer.

This commit is contained in:
Henry Faber 2026-06-28 02:38:02 +01:00
parent 99a5d9838d
commit 64e685a3c1
3 changed files with 19 additions and 8 deletions

View file

@ -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