Arcade racing demo got Godot 3.3
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.3KB

  1. extends Position2D
  2. export var max_length : int = 100 setget _set_max_length
  3. export var distance_between_points : float = 10 setget _set_distance_between_points
  4. export var width : float = 2 setget _set_width
  5. export (Curve) var width_curve = null setget _set_width_curve
  6. export (Color) var default_color = Color("6680ff") setget _set_default_color
  7. onready var trailline_node = $TrailLine
  8. func _set_max_length(l : int) -> void:
  9. if l > 0:
  10. max_length = l
  11. if trailline_node:
  12. trailline_node.max_length = max_length
  13. func _set_distance_between_points(d : float) -> void:
  14. if d > 0.0:
  15. distance_between_points = d
  16. if trailline_node:
  17. trailline_node.distance_between_points = distance_between_points
  18. func _set_width(w : float) -> void:
  19. if w > 0:
  20. width = w
  21. if trailline_node:
  22. trailline_node.width = w
  23. func _set_width_curve(c) -> void:
  24. width_curve = c
  25. if trailline_node:
  26. trailline_node.width_curve = c
  27. func _set_default_color(c : Color) -> void:
  28. default_color = c
  29. if trailline_node:
  30. trailline_node.default_color = c
  31. func _ready():
  32. trailline_node.max_length = max_length
  33. trailline_node.distance_between_points = distance_between_points
  34. trailline_node.width = width
  35. trailline_node.width_curve = width_curve
  36. trailline_node.default_color = default_color