diff --git a/project/assets/theme/button/disabled.stylebox b/project/assets/theme/button/disabled.stylebox
new file mode 100644
index 0000000..5838b76
Binary files /dev/null and b/project/assets/theme/button/disabled.stylebox differ
diff --git a/project/assets/theme/button/focused.stylebox b/project/assets/theme/button/focused.stylebox
new file mode 100644
index 0000000..1b8fd76
Binary files /dev/null and b/project/assets/theme/button/focused.stylebox differ
diff --git a/project/assets/theme/button/hover.stylebox b/project/assets/theme/button/hover.stylebox
new file mode 100644
index 0000000..fb464a1
Binary files /dev/null and b/project/assets/theme/button/hover.stylebox differ
diff --git a/project/assets/theme/button/normal.stylebox b/project/assets/theme/button/normal.stylebox
new file mode 100644
index 0000000..4f8c7da
Binary files /dev/null and b/project/assets/theme/button/normal.stylebox differ
diff --git a/project/assets/theme/button/pressed.stylebox b/project/assets/theme/button/pressed.stylebox
new file mode 100644
index 0000000..c04a001
Binary files /dev/null and b/project/assets/theme/button/pressed.stylebox differ
diff --git a/project/assets/theme/empty.stylebox b/project/assets/theme/empty.stylebox
new file mode 100644
index 0000000..4467232
Binary files /dev/null and b/project/assets/theme/empty.stylebox differ
diff --git a/project/assets/theme/fonts/default_font.tres b/project/assets/theme/fonts/default_font.tres
new file mode 100644
index 0000000..9f845d7
--- /dev/null
+++ b/project/assets/theme/fonts/default_font.tres
@@ -0,0 +1,11 @@
+[gd_resource type="DynamicFont" load_steps=2 format=2]
+
+[ext_resource path="res://assets/theme/fonts/montserrat/Montserrat-Medium.ttf" type="DynamicFontData" id=1]
+
+
+[resource]
+
+size = 20
+use_filter = true
+font_data = ExtResource( 1 )
+
diff --git a/project/assets/theme/fonts/default_font_bold.tres b/project/assets/theme/fonts/default_font_bold.tres
new file mode 100644
index 0000000..238d067
--- /dev/null
+++ b/project/assets/theme/fonts/default_font_bold.tres
@@ -0,0 +1,11 @@
+[gd_resource type="DynamicFont" load_steps=2 format=2]
+
+[ext_resource path="res://assets/theme/fonts/montserrat/Montserrat-Bold.ttf" type="DynamicFontData" id=1]
+
+
+[resource]
+
+size = 20
+use_filter = true
+font_data = ExtResource( 1 )
+
diff --git a/project/assets/theme/fonts/default_font_code.tres b/project/assets/theme/fonts/default_font_code.tres
new file mode 100644
index 0000000..4f13506
--- /dev/null
+++ b/project/assets/theme/fonts/default_font_code.tres
@@ -0,0 +1,11 @@
+[gd_resource type="DynamicFont" load_steps=2 format=2]
+
+[ext_resource path="res://assets/theme/fonts/source_code_pro/SourceCodePro-Medium.otf" type="DynamicFontData" id=1]
+
+
+[resource]
+
+size = 20
+use_filter = true
+font_data = ExtResource( 1 )
+
diff --git a/project/assets/theme/fonts/font_title.tres b/project/assets/theme/fonts/font_title.tres
new file mode 100644
index 0000000..f85490d
--- /dev/null
+++ b/project/assets/theme/fonts/font_title.tres
@@ -0,0 +1,11 @@
+[gd_resource type="DynamicFont" load_steps=2 format=2]
+
+[ext_resource path="res://assets/theme/fonts/montserrat/Montserrat-Black.ttf" type="DynamicFontData" id=1]
+
+
+[resource]
+
+size = 28
+use_filter = true
+font_data = ExtResource( 1 )
+
diff --git a/project/assets/theme/fonts/montserrat/Montserrat-Black.ttf b/project/assets/theme/fonts/montserrat/Montserrat-Black.ttf
new file mode 100644
index 0000000..f0d24ad
Binary files /dev/null and b/project/assets/theme/fonts/montserrat/Montserrat-Black.ttf differ
diff --git a/project/assets/theme/fonts/montserrat/Montserrat-Bold.ttf b/project/assets/theme/fonts/montserrat/Montserrat-Bold.ttf
new file mode 100644
index 0000000..9a425b9
Binary files /dev/null and b/project/assets/theme/fonts/montserrat/Montserrat-Bold.ttf differ
diff --git a/project/assets/theme/fonts/montserrat/Montserrat-Medium.ttf b/project/assets/theme/fonts/montserrat/Montserrat-Medium.ttf
new file mode 100644
index 0000000..db5b1af
Binary files /dev/null and b/project/assets/theme/fonts/montserrat/Montserrat-Medium.ttf differ
diff --git a/project/assets/theme/fonts/source_code_pro/SourceCodePro-Medium.otf b/project/assets/theme/fonts/source_code_pro/SourceCodePro-Medium.otf
new file mode 100644
index 0000000..1b42738
Binary files /dev/null and b/project/assets/theme/fonts/source_code_pro/SourceCodePro-Medium.otf differ
diff --git a/project/assets/theme/gdquest.theme b/project/assets/theme/gdquest.theme
new file mode 100644
index 0000000..1cc33cd
Binary files /dev/null and b/project/assets/theme/gdquest.theme differ
diff --git a/project/assets/theme/icons/chevron-right.svg b/project/assets/theme/icons/chevron-right.svg
new file mode 100644
index 0000000..258de41
--- /dev/null
+++ b/project/assets/theme/icons/chevron-right.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/project/assets/theme/icons/chevron-right.svg.import b/project/assets/theme/icons/chevron-right.svg.import
new file mode 100644
index 0000000..000f669
--- /dev/null
+++ b/project/assets/theme/icons/chevron-right.svg.import
@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="StreamTexture"
+path="res://.import/chevron-right.svg-f77dee7a088177a2ac1d467f4c7cd3e1.stex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://assets/theme/icons/chevron-right.svg"
+dest_files=[ "res://.import/chevron-right.svg-f77dee7a088177a2ac1d467f4c7cd3e1.stex" ]
+
+[params]
+
+compress/mode=0
+compress/lossy_quality=0.7
+compress/hdr_mode=0
+compress/bptc_ldr=0
+compress/normal_map=0
+flags/repeat=0
+flags/filter=true
+flags/mipmaps=false
+flags/anisotropic=false
+flags/srgb=2
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/HDR_as_SRGB=false
+process/invert_color=false
+stream=false
+size_limit=0
+detect_3d=true
+svg/scale=1.0
diff --git a/project/assets/theme/icons/chevron-up.svg b/project/assets/theme/icons/chevron-up.svg
new file mode 100644
index 0000000..4eb5ecc
--- /dev/null
+++ b/project/assets/theme/icons/chevron-up.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/project/assets/theme/icons/chevron-up.svg.import b/project/assets/theme/icons/chevron-up.svg.import
new file mode 100644
index 0000000..14e96f7
--- /dev/null
+++ b/project/assets/theme/icons/chevron-up.svg.import
@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="StreamTexture"
+path="res://.import/chevron-up.svg-48b5b69265734774d0a7516dcc6f0863.stex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://assets/theme/icons/chevron-up.svg"
+dest_files=[ "res://.import/chevron-up.svg-48b5b69265734774d0a7516dcc6f0863.stex" ]
+
+[params]
+
+compress/mode=0
+compress/lossy_quality=0.7
+compress/hdr_mode=0
+compress/bptc_ldr=0
+compress/normal_map=0
+flags/repeat=0
+flags/filter=true
+flags/mipmaps=false
+flags/anisotropic=false
+flags/srgb=2
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/HDR_as_SRGB=false
+process/invert_color=false
+stream=false
+size_limit=0
+detect_3d=true
+svg/scale=1.0
diff --git a/project/assets/theme/panel/panel.stylebox b/project/assets/theme/panel/panel.stylebox
new file mode 100644
index 0000000..1c623a7
Binary files /dev/null and b/project/assets/theme/panel/panel.stylebox differ
diff --git a/project/assets/theme/separator/line.tres b/project/assets/theme/separator/line.tres
new file mode 100644
index 0000000..85da689
--- /dev/null
+++ b/project/assets/theme/separator/line.tres
@@ -0,0 +1,7 @@
+[gd_resource type="StyleBoxLine" format=2]
+
+[resource]
+
+color = Color( 1, 1, 1, 0.196078 )
+thickness = 2
+
diff --git a/project/assets/theme/slider/grabber_area.stylebox b/project/assets/theme/slider/grabber_area.stylebox
new file mode 100644
index 0000000..2f566a6
Binary files /dev/null and b/project/assets/theme/slider/grabber_area.stylebox differ
diff --git a/project/assets/theme/slider/slider.stylebox b/project/assets/theme/slider/slider.stylebox
new file mode 100644
index 0000000..6fbfe55
Binary files /dev/null and b/project/assets/theme/slider/slider.stylebox differ
diff --git a/project/demos/follow_path/FollowPathDemo.tscn b/project/demos/follow_path/FollowPathDemo.tscn
new file mode 100644
index 0000000..ee075a6
--- /dev/null
+++ b/project/demos/follow_path/FollowPathDemo.tscn
@@ -0,0 +1,3 @@
+[gd_scene format=2]
+
+[node name="FollowPathDemo" type="Node2D"]
diff --git a/project/demos/seek_and_flee/GUI.gd b/project/demos/seek_and_flee/GUI.gd
index ae83330..e6826ee 100644
--- a/project/demos/seek_and_flee/GUI.gd
+++ b/project/demos/seek_and_flee/GUI.gd
@@ -1,17 +1,27 @@
-extends MarginContainer
+extends PanelContainer
enum BehaviorMode { SEEK, FLEE }
signal mode_changed(behavior_mode)
+signal acc_changed(value)
+signal speed_changed(value)
-onready var seek: CheckBox = $BehaviorControls/Seek
-onready var flee: CheckBox = $BehaviorControls/Flee
+onready var seek: = $MarginContainer/BehaviorControls/Seek
+onready var flee: = $MarginContainer/BehaviorControls/Flee
+onready var max_acc: = $MarginContainer/BehaviorControls/MaxAccValue
+onready var max_speed: = $MarginContainer/BehaviorControls/MaxSpeedValue
+onready var max_acc_label: = $MarginContainer/BehaviorControls/MaxAcc
+onready var max_speed_label: = $MarginContainer/BehaviorControls/MaxSpeed
func _ready() -> void:
seek.connect("pressed", self, "_on_Seek_pressed")
flee.connect("pressed", self, "_on_Flee_pressed")
+ max_acc.connect("value_changed", self, "_on_Acc_changed")
+ max_speed.connect("value_changed", self, "_on_Speed_changed")
+ max_acc_label.text = "Max accel (" + str(max_acc.value) + ")"
+ max_speed_label.text = "Max speed (" + str(max_speed.value) + ")"
func _on_Seek_pressed() -> void:
@@ -26,3 +36,13 @@ func _on_Flee_pressed() -> void:
seek.button_mask = BUTTON_MASK_LEFT
flee.button_mask = 0
emit_signal("mode_changed", BehaviorMode.FLEE)
+
+
+func _on_Acc_changed(value: float) -> void:
+ max_acc_label.text = "Max accel (" + str(value) + ")"
+ emit_signal("acc_changed", value)
+
+
+func _on_Speed_changed(value: float) -> void:
+ max_speed_label.text = "Max speed (" + str(value) + ")"
+ emit_signal("speed_changed", value)
diff --git a/project/demos/seek_and_flee/GUI.tscn b/project/demos/seek_and_flee/GUI.tscn
index 06917bd..c3d7918 100644
--- a/project/demos/seek_and_flee/GUI.tscn
+++ b/project/demos/seek_and_flee/GUI.tscn
@@ -1,98 +1,143 @@
-[gd_scene load_steps=2 format=2]
+[gd_scene load_steps=3 format=2]
+[ext_resource path="res://assets/theme/gdquest.theme" type="Theme" id=1]
[ext_resource path="res://demos/seek_and_flee/GUI.gd" type="Script" id=3]
-[node name="GUI" type="MarginContainer"]
+[node name="GUI" type="PanelContainer"]
anchor_bottom = 1.0
-margin_right = 116.0
-custom_constants/margin_right = 20
-custom_constants/margin_top = 20
-custom_constants/margin_left = 20
-custom_constants/margin_bottom = 20
+margin_right = 118.0
+theme = ExtResource( 1 )
script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
-[node name="BehaviorControls" type="VBoxContainer" parent="."]
+[node name="MarginContainer" type="MarginContainer" parent="."]
+margin_right = 218.0
+margin_bottom = 600.0
+custom_constants/margin_right = 20
+custom_constants/margin_top = 20
+custom_constants/margin_left = 20
+custom_constants/margin_bottom = 20
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="BehaviorControls" type="VBoxContainer" parent="MarginContainer"]
margin_left = 20.0
margin_top = 20.0
-margin_right = 96.0
+margin_right = 198.0
margin_bottom = 580.0
-[node name="Seek" type="CheckBox" parent="BehaviorControls"]
-margin_right = 76.0
-margin_bottom = 24.0
+[node name="Seek" type="CheckBox" parent="MarginContainer/BehaviorControls"]
+margin_right = 178.0
+margin_bottom = 26.0
focus_mode = 0
pressed = true
enabled_focus_mode = 0
text = "Seek"
-[node name="Flee" type="CheckBox" parent="BehaviorControls"]
-margin_top = 28.0
-margin_right = 76.0
-margin_bottom = 52.0
+[node name="Flee" type="CheckBox" parent="MarginContainer/BehaviorControls"]
+margin_top = 34.0
+margin_right = 178.0
+margin_bottom = 60.0
focus_mode = 0
enabled_focus_mode = 0
text = "Flee"
-[node name="Help" type="VBoxContainer" parent="BehaviorControls"]
-margin_top = 56.0
-margin_right = 76.0
-margin_bottom = 108.0
+[node name="MaxAcc" type="Label" parent="MarginContainer/BehaviorControls"]
+margin_top = 68.0
+margin_right = 178.0
+margin_bottom = 94.0
+text = "Max accel (2000)"
+__meta__ = {
+"_edit_use_anchors_": false
+}
-[node name="Controls" type="Label" parent="BehaviorControls/Help"]
-margin_right = 76.0
-margin_bottom = 14.0
+[node name="MaxAccValue" type="HSlider" parent="MarginContainer/BehaviorControls"]
+margin_top = 102.0
+margin_right = 178.0
+margin_bottom = 118.0
+max_value = 250.0
+step = 0.5
+value = 20.0
+
+[node name="MaxSpeed" type="Label" parent="MarginContainer/BehaviorControls"]
+margin_top = 126.0
+margin_right = 178.0
+margin_bottom = 152.0
+text = "Max speed (2000)"
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="MaxSpeedValue" type="HSlider" parent="MarginContainer/BehaviorControls"]
+margin_top = 160.0
+margin_right = 178.0
+margin_bottom = 176.0
+max_value = 450.0
+step = 1.0
+value = 100.0
+
+[node name="Help" type="VBoxContainer" parent="MarginContainer/BehaviorControls"]
+margin_top = 184.0
+margin_right = 178.0
+margin_bottom = 274.0
+
+[node name="Controls" type="Label" parent="MarginContainer/BehaviorControls/Help"]
+margin_right = 178.0
+margin_bottom = 26.0
text = "Controls"
-[node name="GridContainer" type="GridContainer" parent="BehaviorControls/Help"]
-margin_top = 18.0
-margin_right = 76.0
-margin_bottom = 52.0
+[node name="GridContainer" type="GridContainer" parent="MarginContainer/BehaviorControls/Help"]
+margin_left = 57.0
+margin_top = 34.0
+margin_right = 120.0
+margin_bottom = 90.0
+size_flags_horizontal = 4
columns = 3
-[node name="Sep" type="Control" parent="BehaviorControls/Help/GridContainer"]
+[node name="Sep" type="Control" parent="MarginContainer/BehaviorControls/Help/GridContainer"]
margin_right = 15.0
-margin_bottom = 15.0
+margin_bottom = 26.0
rect_min_size = Vector2( 15, 15 )
-[node name="W" type="Label" parent="BehaviorControls/Help/GridContainer"]
+[node name="W" type="Label" parent="MarginContainer/BehaviorControls/Help/GridContainer"]
margin_left = 19.0
-margin_right = 34.0
-margin_bottom = 15.0
+margin_right = 42.0
+margin_bottom = 26.0
rect_min_size = Vector2( 15, 15 )
text = "W"
align = 1
-[node name="Sep2" type="Control" parent="BehaviorControls/Help/GridContainer"]
-margin_left = 38.0
-margin_right = 53.0
-margin_bottom = 15.0
+[node name="Sep2" type="Control" parent="MarginContainer/BehaviorControls/Help/GridContainer"]
+margin_left = 46.0
+margin_right = 63.0
+margin_bottom = 26.0
rect_min_size = Vector2( 15, 15 )
-[node name="A" type="Label" parent="BehaviorControls/Help/GridContainer"]
-margin_top = 19.0
+[node name="A" type="Label" parent="MarginContainer/BehaviorControls/Help/GridContainer"]
+margin_top = 30.0
margin_right = 15.0
-margin_bottom = 34.0
+margin_bottom = 56.0
rect_min_size = Vector2( 15, 15 )
text = "A"
align = 1
-[node name="S" type="Label" parent="BehaviorControls/Help/GridContainer"]
+[node name="S" type="Label" parent="MarginContainer/BehaviorControls/Help/GridContainer"]
margin_left = 19.0
-margin_top = 19.0
-margin_right = 34.0
-margin_bottom = 34.0
+margin_top = 30.0
+margin_right = 42.0
+margin_bottom = 56.0
rect_min_size = Vector2( 15, 15 )
text = "S"
align = 1
-[node name="D" type="Label" parent="BehaviorControls/Help/GridContainer"]
-margin_left = 38.0
-margin_top = 19.0
-margin_right = 53.0
-margin_bottom = 34.0
+[node name="D" type="Label" parent="MarginContainer/BehaviorControls/Help/GridContainer"]
+margin_left = 46.0
+margin_top = 30.0
+margin_right = 63.0
+margin_bottom = 56.0
rect_min_size = Vector2( 15, 15 )
text = "D"
align = 1
diff --git a/project/demos/seek_and_flee/SeekFleeDemo.gd b/project/demos/seek_and_flee/SeekFleeDemo.gd
index bf3bbc2..6ae0274 100644
--- a/project/demos/seek_and_flee/SeekFleeDemo.gd
+++ b/project/demos/seek_and_flee/SeekFleeDemo.gd
@@ -23,6 +23,9 @@ func _ready() -> void:
var rng: = RandomNumberGenerator.new()
rng.randomize()
+ gui.max_acc.value = spawner.max_accel
+ gui.max_speed.value = spawner.max_speed
+
for i in range(spawner.entity_count):
var new_pos: = Vector2(
rng.randf_range(-camera_boundaries.size.x/2, camera_boundaries.size.x/2),
@@ -31,7 +34,10 @@ func _ready() -> void:
var entity: KinematicBody2D = spawner.Entity.instance()
entity.global_position = new_pos
entity.player_agent = player.agent
- entity.speed = rng.randf_range(spawner.min_speed, spawner.max_speed)
+ entity.start_speed = spawner.max_speed
+ entity.start_accel = spawner.max_accel
entity.color = spawner.entity_color
gui.connect("mode_changed", entity, "_on_GUI_mode_changed")
+ gui.connect("acc_changed", entity, "_on_GUI_acc_changed")
+ gui.connect("speed_changed", entity, "_on_GUI_speed_changed")
spawner.add_child(entity)
diff --git a/project/demos/seek_and_flee/SeekFleeDemo.tscn b/project/demos/seek_and_flee/SeekFleeDemo.tscn
index cb19392..25c2750 100644
--- a/project/demos/seek_and_flee/SeekFleeDemo.tscn
+++ b/project/demos/seek_and_flee/SeekFleeDemo.tscn
@@ -71,9 +71,11 @@ shape = SubResource( 3 )
[node name="Spawner" type="Node2D" parent="."]
script = ExtResource( 4 )
Entity = ExtResource( 6 )
+max_speed = 150.0
[node name="GUI" parent="." instance=ExtResource( 5 )]
margin_left = -512.0
margin_top = -300.0
-margin_right = -414.0
-margin_bottom = -152.0
+margin_right = -386.0
+margin_bottom = -102.0
+rect_min_size = Vector2( 0, 600 )
diff --git a/project/demos/seek_and_flee/Seeker.gd b/project/demos/seek_and_flee/Seeker.gd
index 58473fd..32022db 100644
--- a/project/demos/seek_and_flee/Seeker.gd
+++ b/project/demos/seek_and_flee/Seeker.gd
@@ -12,14 +12,15 @@ onready var _active_behavior: = seek
var player_agent: GSTAgentLocation
var velocity: = Vector2.ZERO
-var speed: float
+var start_speed: float
+var start_accel: float
var color: Color
var radius: = 0.0
func _ready() -> void:
- agent.max_linear_acceleration = speed/10
- agent.max_linear_speed = speed
+ agent.max_linear_acceleration = start_accel
+ agent.max_linear_speed = start_speed
radius = collision_shape.shape.radius
@@ -36,12 +37,13 @@ func _physics_process(delta: float) -> void:
velocity = (velocity + Vector2(accel.linear.x, accel.linear.y)).clamped(agent.max_linear_speed)
velocity = move_and_slide(velocity)
- if velocity.length_squared() > 0:
- update()
func _update_agent() -> void:
- agent.position = Vector3(global_position.x, global_position.y, 0)
+ agent.position.x = global_position.x
+ agent.position.y = global_position.y
+ agent.linear_velocity.x = velocity.x
+ agent.linear_velocity.y = velocity.y
func _on_GUI_mode_changed(mode: int) -> void:
@@ -49,3 +51,11 @@ func _on_GUI_mode_changed(mode: int) -> void:
_active_behavior = seek
else:
_active_behavior = flee
+
+
+func _on_GUI_acc_changed(value: float) -> void:
+ agent.max_linear_acceleration = value
+
+
+func _on_GUI_speed_changed(value: float) -> void:
+ agent.max_linear_speed = value
diff --git a/project/demos/seek_and_flee/Seeker.tscn b/project/demos/seek_and_flee/Seeker.tscn
index 804897a..1d154bb 100644
--- a/project/demos/seek_and_flee/Seeker.tscn
+++ b/project/demos/seek_and_flee/Seeker.tscn
@@ -2,13 +2,11 @@
[ext_resource path="res://demos/seek_and_flee/Seeker.gd" type="Script" id=1]
-
-
[sub_resource type="CircleShape2D" id=1]
[node name="Seeker" type="KinematicBody2D"]
collision_layer = 4
-collision_mask = 6
+collision_mask = 2
script = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
diff --git a/project/demos/seek_and_flee/Spawner.gd b/project/demos/seek_and_flee/Spawner.gd
index 9d6cbc2..87555d7 100644
--- a/project/demos/seek_and_flee/Spawner.gd
+++ b/project/demos/seek_and_flee/Spawner.gd
@@ -5,5 +5,5 @@ extends Node2D
export(PackedScene) var Entity: PackedScene
export var entity_count: = 10
export var entity_color: = Color.blue
-export var min_speed: = 50.0
-export var max_speed: = 125.0
+export var max_speed: = 100.0
+export var max_accel: = 20.0