109 lines
4.0 KiB
Plaintext
109 lines
4.0 KiB
Plaintext
[gd_scene format=3 uid="uid://i4v5fyt2ix01"]
|
|
|
|
[ext_resource type="PackedScene" uid="uid://nji5r3vfeuwg" path="res://godot_state_charts_examples/random_transitions/wandering_frog/wandering_frog.tscn" id="1_r2x6m"]
|
|
[ext_resource type="PackedScene" uid="uid://bcwkugn6v3oy7" path="res://addons/godot_state_charts/utilities/state_chart_debugger.tscn" id="2_n8tkm"]
|
|
|
|
[sub_resource type="Shader" id="Shader_8j6vc"]
|
|
code = "shader_type canvas_item;
|
|
|
|
void fragment() {
|
|
COLOR.rgb *= (1.0-0.3*(1.0-UV.y));
|
|
}
|
|
|
|
void vertex() {
|
|
VERTEX.x -= UV.y * (0.5 - UV.x) * 100.0;
|
|
}
|
|
"
|
|
|
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_8axp2"]
|
|
shader = SubResource("Shader_8j6vc")
|
|
|
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_fkyfr"]
|
|
size = Vector2(36, 418)
|
|
|
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_e3j0h"]
|
|
size = Vector2(405, 35)
|
|
|
|
[node name="Random Transitions" type="Node2D" unique_id=52279508]
|
|
|
|
[node name="Ground" type="ColorRect" parent="." unique_id=1712463191]
|
|
material = SubResource("ShaderMaterial_8axp2")
|
|
offset_left = 39.0
|
|
offset_top = 68.0
|
|
offset_right = 319.0
|
|
offset_bottom = 478.0
|
|
color = Color(0.0980392, 0.560784, 0.152941, 1)
|
|
|
|
[node name="ColliderLeft" type="StaticBody2D" parent="." unique_id=228059170]
|
|
position = Vector2(0, 40)
|
|
collision_layer = 2
|
|
|
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="ColliderLeft" unique_id=1963745429]
|
|
position = Vector2(35, 199)
|
|
shape = SubResource("RectangleShape2D_fkyfr")
|
|
|
|
[node name="ColliderRight" type="StaticBody2D" parent="." unique_id=1906713239]
|
|
position = Vector2(329, 45)
|
|
collision_layer = 2
|
|
collision_mask = 2
|
|
|
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="ColliderRight" unique_id=173218133]
|
|
position = Vector2(-9, 196)
|
|
shape = SubResource("RectangleShape2D_fkyfr")
|
|
|
|
[node name="ColliderTop" type="StaticBody2D" parent="." unique_id=1640986237]
|
|
position = Vector2(375, 45)
|
|
collision_layer = 2
|
|
collision_mask = 2
|
|
|
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="ColliderTop" unique_id=231369578]
|
|
position = Vector2(-176, 12)
|
|
shape = SubResource("RectangleShape2D_e3j0h")
|
|
|
|
[node name="ColliderBottom" type="StaticBody2D" parent="." unique_id=1273630072]
|
|
position = Vector2(375, 428)
|
|
collision_layer = 2
|
|
collision_mask = 2
|
|
|
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="ColliderBottom" unique_id=2073493117]
|
|
position = Vector2(-188, -27)
|
|
shape = SubResource("RectangleShape2D_e3j0h")
|
|
|
|
[node name="WanderingFrog" parent="." unique_id=1965360825 instance=ExtResource("1_r2x6m")]
|
|
modulate = Color(0.454902, 0.458824, 1, 1)
|
|
position = Vector2(106, 158)
|
|
|
|
[node name="WanderingFrog2" parent="." unique_id=1639439330 instance=ExtResource("1_r2x6m")]
|
|
position = Vector2(224, 208)
|
|
|
|
[node name="WanderingFrog3" parent="." unique_id=1873590311 instance=ExtResource("1_r2x6m")]
|
|
position = Vector2(149, 275)
|
|
|
|
[node name="WanderingFrog4" parent="." unique_id=455681562 instance=ExtResource("1_r2x6m")]
|
|
position = Vector2(297, 340)
|
|
|
|
[node name="WanderingFrog5" parent="." unique_id=1101589222 instance=ExtResource("1_r2x6m")]
|
|
position = Vector2(79, 359)
|
|
|
|
[node name="WanderingFrog6" parent="." unique_id=1055250854 instance=ExtResource("1_r2x6m")]
|
|
position = Vector2(225, 126)
|
|
|
|
[node name="StateChartDebugger" parent="." unique_id=1215457625 instance=ExtResource("2_n8tkm")]
|
|
offset_left = 344.0
|
|
offset_top = 33.0
|
|
offset_right = 636.0
|
|
offset_bottom = 438.0
|
|
initial_node_to_watch = NodePath("../WanderingFrog")
|
|
|
|
[node name="Label" type="RichTextLabel" parent="." unique_id=1358525059]
|
|
offset_left = 10.0
|
|
offset_top = 375.0
|
|
offset_right = 334.0
|
|
offset_bottom = 459.0
|
|
mouse_filter = 2
|
|
bbcode_enabled = true
|
|
text = "[font_size=10]
|
|
The frogs random movement is controlled by the state chart. Each frog choses to wander or be idle for a random amount of seconds. Even though all frog instances use the same state chart they behave differently because they use random expressions to control which state they enter and for how long they stay in there. The debugger shows the state chart of the blue-tinted frog.
|
|
[/font_size]"
|
|
fit_content = true
|