2020-07-21 00:13:31 -05:00
|
|
|
extends Node2D
|
|
|
|
class_name Beam
|
|
|
|
|
|
|
|
var max_cast = Vector2(400, 0)
|
|
|
|
|
|
|
|
onready var Beam: Sprite = $Beam
|
|
|
|
onready var Begin: Sprite = $Begin
|
|
|
|
onready var Ray: RayCast2D = $Raycast2D
|
|
|
|
onready var End: Position2D = $End
|
|
|
|
|
|
|
|
func _physics_process(delta):
|
|
|
|
Ray.cast_to = max_cast
|
|
|
|
if Ray.is_colliding():
|
|
|
|
End.global_position = Ray.get_collision_point()
|
|
|
|
else:
|
|
|
|
End.position = max_cast
|
2020-07-21 00:19:23 -05:00
|
|
|
Beam.
|