|
@@ -1,5 +1,7 @@
|
|
|
extends Node2D
|
|
|
|
|
|
+export (float) var visor_ratio = 1.0
|
|
|
+
|
|
|
signal get_firing
|
|
|
signal is_full
|
|
|
signal gain_new_bullet
|
|
@@ -36,7 +38,12 @@ func _input(event):
|
|
|
if event is InputEventMouseButton and event.is_pressed() :
|
|
|
trigger(event.position)
|
|
|
elif event is InputEventMouseMotion and current_state == State.READY:
|
|
|
- target.position = event.position
|
|
|
+ aim_at(event.position)
|
|
|
+
|
|
|
+
|
|
|
+func aim_at(cursor:Vector2):
|
|
|
+ target.position = source.position
|
|
|
+ target.position += (cursor - source.position) * visor_ratio
|
|
|
|
|
|
|
|
|
func trigger(aim:Vector2):
|