[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"] [ext_resource type="AudioStream" uid="uid://dmdbharecy448" path="res://sounds/gravity.ogg" id="2_5uwlw"] [sub_resource type="GDScript" id="GDScript_3yq1l"] script/source = "extends Control @onready var direction_node: TextureRect = $Direction @onready var animation: AnimationPlayer = $Direction/AnimationPlayer @onready var audio: AudioStreamPlayer = $Direction/AudioStreamPlayer func _ready() -> void: # set the indicator to be fully transparent when it first spawns direction_node.self_modulate = Color(1, 1, 1, 0) func react_to_gravity_change(direction: Vector3) -> void: if direction == Vector3.UP: direction_node.rotation_degrees = -90 audio.pitch_scale = 1.05 elif direction == Vector3.LEFT: direction_node.rotation_degrees = -180 audio.pitch_scale = 1.02 elif direction == Vector3.RIGHT: direction = Vector3.RIGHT direction_node.rotation_degrees = 0 audio.pitch_scale = 0.98 elif direction == Vector3.DOWN: direction_node.rotation_degrees = 90 audio.pitch_scale = 0.95 if animation.is_playing(): animation.stop() animation.play(\"grow_fadeout\") if Settings.sound_on_gravity_change: audio.play() " [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 mouse_filter = 2 script = SubResource("GDScript_3yq1l") [node name="Direction" type="TextureRect" parent="."] self_modulate = Color(1, 1, 1, 0.501961) layout_mode = 1 anchors_preset = 8 anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 offset_left = -400.0 offset_top = -400.0 offset_right = 400.0 offset_bottom = 400.0 grow_horizontal = 2 grow_vertical = 2 scale = Vector2(0.3, 0.3) pivot_offset = Vector2(400, 400) mouse_filter = 2 texture = ExtResource("1_4mbho") [node name="AnimationPlayer" type="AnimationPlayer" parent="Direction"] libraries = { &"": SubResource("AnimationLibrary_0w0ne") } [node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="Direction"] stream = ExtResource("2_5uwlw") volume_db = -6.0 mix_target = 2 bus = &"Sounds"