pause menu had classic issues of mouse inputs being eaten by something else (gravity) restart didn't have working code anymore because of level logic changes also remove the demo scene which I believe is unused beyond the jam version
172 lines
4.8 KiB
Text
172 lines
4.8 KiB
Text
[gd_scene load_steps=8 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
|
|
|
|
var player_ready = false
|
|
const normal = 7
|
|
const stronger = normal * 3
|
|
|
|
func _input(_event: InputEvent) -> void:
|
|
if player_ready:
|
|
var grav = stronger if Input.is_action_pressed(\"gravity_strong\") else normal
|
|
PhysicsServer3D.area_set_param(get_viewport().find_world_3d().space, PhysicsServer3D.AREA_PARAM_GRAVITY, grav)
|
|
"
|
|
|
|
[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 up := Input.is_action_just_pressed(\"gravity_up\")
|
|
var left := Input.is_action_just_pressed(\"gravity_left\")
|
|
var right := Input.is_action_just_pressed(\"gravity_right\")
|
|
var down := Input.is_action_just_pressed(\"gravity_down\")
|
|
|
|
if up or left or right or down:
|
|
var direction = Vector3()
|
|
if up:
|
|
direction = Vector3.UP
|
|
self.rotation_degrees = -90
|
|
$AudioStreamPlayer.pitch_scale = 1.05
|
|
elif left:
|
|
direction = Vector3.LEFT
|
|
self.rotation_degrees = -180
|
|
$AudioStreamPlayer.pitch_scale = 1.02
|
|
elif right:
|
|
direction = Vector3.RIGHT
|
|
self.rotation_degrees = 0
|
|
$AudioStreamPlayer.pitch_scale = 0.98
|
|
elif down:
|
|
direction = Vector3.DOWN
|
|
self.rotation_degrees = 90
|
|
$AudioStreamPlayer.pitch_scale = 0.95
|
|
|
|
if get_parent().player_ready == false or direction != PhysicsServer3D.area_get_param(
|
|
get_viewport().find_world_3d().space,
|
|
PhysicsServer3D.AREA_PARAM_GRAVITY_VECTOR
|
|
):
|
|
get_parent().player_ready = true
|
|
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\")
|
|
|
|
if Settings.sound_on_gravity_change:
|
|
$AudioStreamPlayer.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")
|
|
script = SubResource("GDScript_my602")
|
|
|
|
[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"
|