Refactor brick throwing mechanics; integrate new input handling and projectile initialization components

This commit is contained in:
2025-05-13 00:44:44 +02:00
parent 3d65daf0c5
commit c291f42531
25 changed files with 276 additions and 72 deletions

View File

@@ -0,0 +1,20 @@
class_name ProjectileInitComponent
extends Node
@export var launch_component: LaunchComponent
func initialize(params: Dictionary) -> void:
var position := params.get("position", Vector2.ZERO) as Vector2
var direction := params.get("direction", Vector2.RIGHT) as Vector2
var rotation := params.get("rotation", 0.0) as float
var power := params.get("power_multiplier", 1.0) as float
owner.global_position = position
owner.global_rotation = rotation
if launch_component:
launch_component.initial_direction = direction
launch_component.spawn_position = position
launch_component.spawn_rotation = rotation
launch_component.speed *= power