DreamBall/elements/gravity.tscn

165 lines
4.4 KiB
Text
Raw Normal View History

[gd_scene load_steps=7 format=3 uid="uid://dw0xl8644x166"]
[ext_resource type="Texture2D" uid="uid://ctjugvy1v3y6b" path="res://graphics/arrow.svg" id="1_4mbho"]
[sub_resource type="GDScript" id="GDScript_wuka5"]
script/source = "extends HSlider
# Maybe change it so it's not a slider, but just a value that... depends on the mouse position?
# Or a value that's only high if the user is pressing shift, à la catch the beat
func _on_value_changed(value: float) -> void:
PhysicsServer3D.area_set_param(get_viewport().find_world_3d().space, PhysicsServer3D.AREA_PARAM_GRAVITY, value)
func _on_focus_entered() -> void:
release_focus()
"
[sub_resource type="GDScript" id="GDScript_my602"]
script/source = "extends TextureRect
func _ready() -> void:
# set the indicator to be fully transparent when it first spawns
self.self_modulate = Color(1, 1, 1, 0)
func _input(ev: InputEvent) -> void:
if ev is InputEventKey and ev.is_pressed():
var k = ev.keycode
if k == KEY_UP or k == KEY_RIGHT or k == KEY_LEFT or k == KEY_DOWN:
var direction = Vector3()
if k == KEY_UP:
direction = Vector3.UP
self.rotation_degrees = -90
elif k == KEY_LEFT:
direction = Vector3.LEFT
self.rotation_degrees = -180
elif k == KEY_RIGHT:
direction = Vector3.RIGHT
self.rotation_degrees = 0
elif k == KEY_DOWN:
direction = Vector3.DOWN
self.rotation_degrees = 90
PhysicsServer3D.area_set_param(
get_viewport().find_world_3d().space,
PhysicsServer3D.AREA_PARAM_GRAVITY_VECTOR,
direction
)
if $AnimationPlayer.is_playing():
$AnimationPlayer.stop()
$AnimationPlayer.play(\"grow_fadeout\")
"
[sub_resource type="Animation" id="Animation_6rwl4"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0.3, 0.3)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:self_modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 0.501961)]
}
[sub_resource type="Animation" id="Animation_ll6d0"]
resource_name = "grow_fadeout"
length = 0.2
step = 0.2
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.2),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(0.3, 0.3), Vector2(0.8, 0.8)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:self_modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.142857),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0.501961), Color(1, 1, 1, 0)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_0w0ne"]
_data = {
"RESET": SubResource("Animation_6rwl4"),
"grow_fadeout": SubResource("Animation_ll6d0")
}
[node name="Gravity" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Strength" type="HSlider" parent="."]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.2
anchor_top = 0.9
anchor_right = 0.8
anchor_bottom = 1.0
offset_right = -0.00012207
grow_horizontal = 2
grow_vertical = 0
size_flags_horizontal = 4
size_flags_vertical = 1
min_value = 10.0
max_value = 40.0
step = 0.2
value = 10.0
script = SubResource("GDScript_wuka5")
metadata/_edit_use_anchors_ = true
[node name="Direction" type="TextureRect" parent="."]
self_modulate = Color(1, 1, 1, 0.501961)
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
scale = Vector2(0.3, 0.3)
pivot_offset = Vector2(576, 324)
texture = ExtResource("1_4mbho")
expand_mode = 3
stretch_mode = 5
script = SubResource("GDScript_my602")
metadata/_edit_use_anchors_ = true
[node name="AnimationPlayer" type="AnimationPlayer" parent="Direction"]
libraries = {
"": SubResource("AnimationLibrary_0w0ne")
}
[connection signal="focus_entered" from="Strength" to="Strength" method="_on_focus_entered"]
[connection signal="value_changed" from="Strength" to="Strength" method="_on_value_changed"]