godot-steering-ai-framework/project/demos/GroupBehaviors/GroupBehaviorsDemo.gd
Răzvan C. Rădulescu 1a37b2bee0 Update project to follow GDScript guidelines closer
Used `var variable := 0.0` as discussed in the Godot issue, instead of
`var variable: = 0.0`.

Mostly these are minor/cosmetic changes, but I've also reorganized the
folder structure (naming of folders) to reflect our guidelines, plus
made some minor changes to the demo codes. Still work in progress.
2020-01-16 10:44:44 +02:00

69 lines
1.6 KiB
GDScript

extends Node2D
onready var spawner := $Spawner
export var max_linear_speed := 100.0 setget set_max_linear_speed
export var max_linear_accel := 25.0 setget set_max_linear_accel
export var proximity_radius := 140.0 setget set_proximity_radius
export var show_proximity_radius := true setget set_show_proximity_radius
export var separation_decay_coefficient := 2000.0 setget set_separation_decay_coef
export var cohesion_strength := 0.3 setget set_cohesion_strength
export var separation_strength := 1.5 setget set_separation_strength
func set_max_linear_speed(value: float) -> void:
if not is_inside_tree():
return
max_linear_speed = value
spawner.set_max_linear_speed(value)
func set_max_linear_accel(value: float) -> void:
if not is_inside_tree():
return
max_linear_accel = value
spawner.set_max_linear_accel(value)
func set_proximity_radius(value: float) -> void:
if not is_inside_tree():
return
proximity_radius = value
spawner.set_proximity_radius(value)
func set_show_proximity_radius(value: bool) -> void:
if not is_inside_tree():
return
show_proximity_radius = value
spawner.set_show_proximity_radius(value)
func set_separation_decay_coef(value: float) -> void:
if not is_inside_tree():
return
separation_decay_coefficient = value
spawner.set_separation_decay_coef(value)
func set_cohesion_strength(value: float) -> void:
if not is_inside_tree():
return
cohesion_strength = value
spawner.set_cohesion_strength(value)
func set_separation_strength(value: float) -> void:
if not is_inside_tree():
return
separation_strength = value
spawner.set_separation_strength(value)