2025-02-22 17:16:30 +01:00
|
|
|
[gd_scene load_steps=8 format=3 uid="uid://dw0xl8644x166"]
|
2025-02-22 12:05:38 +01:00
|
|
|
|
|
|
|
[ext_resource type="Texture2D" uid="uid://ctjugvy1v3y6b" path="res://graphics/arrow.svg" id="1_4mbho"]
|
2025-02-22 17:16:30 +01:00
|
|
|
[ext_resource type="AudioStream" uid="uid://dmdbharecy448" path="res://sounds/gravity.ogg" id="2_5uwlw"]
|
2025-02-22 12:05:38 +01:00
|
|
|
|
2025-02-22 17:16:30 +01:00
|
|
|
[sub_resource type="GDScript" id="GDScript_3yq1l"]
|
|
|
|
script/source = "extends Control
|
2025-02-22 12:05:38 +01:00
|
|
|
|
2025-02-22 19:46:19 +01:00
|
|
|
var player_ready = false
|
2025-02-22 17:16:30 +01:00
|
|
|
const normal = 7
|
|
|
|
const stronger = normal * 3
|
2025-02-22 12:05:38 +01:00
|
|
|
|
2025-02-23 14:27:35 +01:00
|
|
|
func _input(_event: InputEvent) -> void:
|
2025-02-22 19:46:19 +01:00
|
|
|
if player_ready:
|
|
|
|
var grav = stronger if Input.is_key_pressed(KEY_SHIFT) else normal
|
|
|
|
PhysicsServer3D.area_set_param(get_viewport().find_world_3d().space, PhysicsServer3D.AREA_PARAM_GRAVITY, grav)
|
2025-02-22 12:05:38 +01:00
|
|
|
"
|
|
|
|
|
|
|
|
[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
|
2025-02-22 17:16:30 +01:00
|
|
|
$AudioStreamPlayer.pitch_scale = 1.05
|
2025-02-22 12:05:38 +01:00
|
|
|
elif k == KEY_LEFT:
|
|
|
|
direction = Vector3.LEFT
|
|
|
|
self.rotation_degrees = -180
|
2025-02-22 17:16:30 +01:00
|
|
|
$AudioStreamPlayer.pitch_scale = 1.02
|
2025-02-22 12:05:38 +01:00
|
|
|
elif k == KEY_RIGHT:
|
|
|
|
direction = Vector3.RIGHT
|
|
|
|
self.rotation_degrees = 0
|
2025-02-22 17:16:30 +01:00
|
|
|
$AudioStreamPlayer.pitch_scale = 0.98
|
2025-02-22 12:05:38 +01:00
|
|
|
elif k == KEY_DOWN:
|
|
|
|
direction = Vector3.DOWN
|
|
|
|
self.rotation_degrees = 90
|
2025-02-22 17:16:30 +01:00
|
|
|
$AudioStreamPlayer.pitch_scale = 0.95
|
2025-02-22 12:05:38 +01:00
|
|
|
|
2025-02-22 19:46:19 +01:00
|
|
|
if get_parent().player_ready == false or direction != PhysicsServer3D.area_get_param(
|
2025-02-22 17:16:30 +01:00
|
|
|
get_viewport().find_world_3d().space,
|
|
|
|
PhysicsServer3D.AREA_PARAM_GRAVITY_VECTOR
|
|
|
|
):
|
2025-02-22 19:46:19 +01:00
|
|
|
get_parent().player_ready = true
|
2025-02-22 17:16:30 +01:00
|
|
|
PhysicsServer3D.area_set_param(
|
|
|
|
get_viewport().find_world_3d().space,
|
|
|
|
PhysicsServer3D.AREA_PARAM_GRAVITY_VECTOR,
|
|
|
|
direction
|
|
|
|
)
|
|
|
|
|
|
|
|
if $AnimationPlayer.is_playing():
|
|
|
|
$AnimationPlayer.stop()
|
|
|
|
$AudioStreamPlayer.play()
|
|
|
|
$AnimationPlayer.play(\"grow_fadeout\")
|
2025-02-22 12:05:38 +01:00
|
|
|
"
|
|
|
|
|
|
|
|
[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
|
2025-02-22 17:16:30 +01:00
|
|
|
script = SubResource("GDScript_3yq1l")
|
2025-02-22 12:05:38 +01:00
|
|
|
|
|
|
|
[node name="Direction" type="TextureRect" parent="."]
|
|
|
|
self_modulate = Color(1, 1, 1, 0.501961)
|
|
|
|
layout_mode = 1
|
2025-02-22 17:16:30 +01:00
|
|
|
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
|
2025-02-22 12:05:38 +01:00
|
|
|
grow_horizontal = 2
|
|
|
|
grow_vertical = 2
|
|
|
|
scale = Vector2(0.3, 0.3)
|
2025-02-22 17:16:30 +01:00
|
|
|
pivot_offset = Vector2(400, 400)
|
2025-02-22 12:05:38 +01:00
|
|
|
texture = ExtResource("1_4mbho")
|
|
|
|
script = SubResource("GDScript_my602")
|
|
|
|
|
|
|
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="Direction"]
|
|
|
|
libraries = {
|
|
|
|
"": SubResource("AnimationLibrary_0w0ne")
|
|
|
|
}
|
|
|
|
|
2025-02-22 17:16:30 +01:00
|
|
|
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="Direction"]
|
|
|
|
stream = ExtResource("2_5uwlw")
|
|
|
|
volume_db = -6.0
|
|
|
|
mix_target = 2
|