forked from kanium/starcheese
20 lines
740 B
GDScript
20 lines
740 B
GDScript
extends Node2D
|
|
|
|
@export var hardpoint_id: String = "HardPoint1" # Unique identifier for this hardpoint
|
|
|
|
# Optional - can store a reference to the mounted weapon
|
|
var mounted_weapon: Node2D = null
|
|
|
|
# Method to attach a weapon to the hardpoint
|
|
func attach_weapon(weapon: Node2D) -> void:
|
|
mounted_weapon = weapon
|
|
weapon.global_position = global_position # Set weapon position to the hardpoint position
|
|
weapon.rotation = rotation # Align the weapon's rotation to the hardpoint's rotation
|
|
|
|
func _draw():
|
|
draw_circle(Vector2.ZERO, 10, Color(1, 0, 0)) # Draw a red circle at the hardpoint
|
|
|
|
func _ready():
|
|
add_to_group("hardpoints") # Add the hardpoint to the "hardpoints" group
|
|
queue_redraw() # Redraw the visual to ensure it's updated
|