26 lines
481 B
GDScript3
26 lines
481 B
GDScript3
|
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)
|