weapon_pivot.gd 322 B

12345678910111213141516
  1. extends Marker2D
  2. var z_index_start = 0
  3. func _ready():
  4. owner.direction_changed.connect(self._on_Parent_direction_changed)
  5. z_index_start = z_index
  6. func _on_Parent_direction_changed(direction):
  7. rotation = direction.angle()
  8. match direction:
  9. Vector2.UP:
  10. z_index = z_index_start - 1
  11. _:
  12. z_index = z_index_start