This repository has been archived on 2020-09-30. You can view files and clone it, but cannot push or open issues or pull requests.
odyssey-old/Actors/Systems/Electricity/ElectricProbe.gd

26 lines
481 B
GDScript

extends Area2D
class_name ProbeElectric
const DEBUG = true
const center = Vector2.ONE * 16
var neighbours = []
func _physics_process(delta):
if DEBUG:
update()
func _draw():
if DEBUG:
draw_circle(center, 4, Color.cyan)
for neighbour in neighbours:
var delta = (neighbour.global_position - global_position) / global_scale
draw_line(center, delta + center, Color.cyan, 2)
func _got_neighbour(area: Area2D):
if area == self:
return
neighbours.push_back(area)