diff --git a/autoload/configuration.gd b/autoload/configuration.gd index f99d4258..d37b4a72 100644 --- a/autoload/configuration.gd +++ b/autoload/configuration.gd @@ -30,6 +30,9 @@ func _ready(): if not config.has_section_key("graphics", "grass_amount"): config.set_value("graphics", "grass_amount", 0) + + if not config.has_section_key("debug", "mid_air_dash"): + config.set_value("debug", "mid_air_dash", false) # Handle fullscreen if config.get_value("graphics", "fullscreen") == true: diff --git a/autoload/game_state.gd b/autoload/game_state.gd index cbf9d189..ad44d06b 100644 --- a/autoload/game_state.gd +++ b/autoload/game_state.gd @@ -6,6 +6,10 @@ var MapName: String var UserInterface: Control var RetryCamera: Camera # Camera to be used when player dies. +var upgrades = { + "mid_air_dash": false +} + # This variable is used to work around a bug in Scatter on which, # after "test_map" is reloaded, the modifiers are not re-inserted # and we end up without any grass. diff --git a/entities/player/player.gd b/entities/player/player.gd index 86adc4d4..4db91f03 100644 --- a/entities/player/player.gd +++ b/entities/player/player.gd @@ -7,11 +7,17 @@ export var speed := 14.0 export var jump_impulse := 25.0 export var fall_acceleration := 75.0 export var bounce_impulse := 16.0 +export var dash_duration := 0.2 +export var dash_speed := 150 var velocity = Vector3.ZERO +var dash_available := true +var is_dashing := false + func _ready(): GameState.Player = self + $DashDurationTimer.wait_time = dash_duration func _physics_process(delta): if not $AnimationPlayer.is_playing(): @@ -52,6 +58,19 @@ func _physics_process(delta): speed = 14 $AnimationPlayer.playback_speed = 1.0 + if GameState.upgrades["mid_air_dash"]: + if is_on_floor(): + dash_available = true + + if dash_available and !is_on_floor() and Input.is_action_just_pressed("ui_sprint"): + if $DashDurationTimer.is_stopped(): + is_dashing = true + dash_available = false + $DashDurationTimer.start() + + if is_dashing: + speed = dash_speed + velocity.x = direction.x * speed velocity.z = direction.z * speed @@ -101,3 +120,6 @@ func _on_EnemyDetector_body_entered(_body): func set_draw_distance(value: int): $CameraPivot/Horizontal/Vertical/ClippedCamera.far = value + +func _on_DashDurationTimer_timeout(): + is_dashing = false diff --git a/entities/player/player.tscn b/entities/player/player.tscn index 1dac1f8a..cc12d742 100644 --- a/entities/player/player.tscn +++ b/entities/player/player.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=11 format=2] +[gd_scene load_steps=12 format=2] [ext_resource path="res://entities/player/player.glb" type="PackedScene" id=1] [ext_resource path="res://entities/player/player.gd" type="Script" id=2] @@ -10,6 +10,21 @@ height = 0.25 [sub_resource type="CylinderShape" id=2] radius = 1.4 +[sub_resource type="Animation" id=8] +length = 0.001 +tracks/0/type = "value" +tracks/0/path = NodePath(".:translation") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 0, +"values": [ Vector3( 0, 0, 0 ) ] +} + [sub_resource type="Animation" id=3] resource_name = "float" loop = true @@ -93,7 +108,7 @@ script = ExtResource( 2 ) [node name="Pivot" type="Spatial" parent="."] [node name="Character" parent="Pivot" instance=ExtResource( 1 )] -transform = Transform( 0.999737, 0.00211386, 0.0228296, -0.00598565, 0.985271, 0.17089, -0.0221321, -0.170982, 0.985025, 0.0239411, 0.734308, -0.00194665 ) +transform = Transform( 0.999737, 0.00211385, 0.0228296, -0.00598565, 0.985271, 0.17089, -0.0221321, -0.170982, 0.985025, 0.0239411, 0.734308, -0.00194665 ) [node name="CollisionShape" type="CollisionShape" parent="."] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1.425, 0, 0.785568, 0.44 ) @@ -111,6 +126,7 @@ shape = SubResource( 2 ) [node name="AnimationPlayer" type="AnimationPlayer" parent="."] autoplay = "float" +anims/RESET = SubResource( 8 ) anims/float = SubResource( 3 ) anims/spin-y = SubResource( 4 ) @@ -139,4 +155,9 @@ monitorable = false transform = Transform( 2, 0, 0, 0, 0.25, 0, 0, 0, 2, 0, 0.8, 0 ) shape = SubResource( 5 ) +[node name="DashDurationTimer" type="Timer" parent="."] +wait_time = 0.2 +one_shot = true + [connection signal="body_entered" from="EnemyDetector" to="." method="_on_EnemyDetector_body_entered"] +[connection signal="timeout" from="DashDurationTimer" to="." method="_on_DashDurationTimer_timeout"] diff --git a/icon.png b/icon.png index e0af83e7..a9ddaf81 100644 Binary files a/icon.png and b/icon.png differ diff --git a/props/portal/portal_placeholder.gd b/props/portal/portal_placeholder.gd index b2fe109c..d3cced58 100644 --- a/props/portal/portal_placeholder.gd +++ b/props/portal/portal_placeholder.gd @@ -6,6 +6,7 @@ func _ready(): $Label3D.text = map_name func _on_Portal_entered(_body): + $AnimationPlayer.play("shrink") #$AudioStreamPlayer.play() GameState.Player.get_node("EffectsAnimationPlayer").play("shrink") GameState.change_map(map_name) diff --git a/props/portal/portal_placeholder.tscn b/props/portal/portal_placeholder.tscn index f462b1d6..bc7c36f6 100644 --- a/props/portal/portal_placeholder.tscn +++ b/props/portal/portal_placeholder.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=8 format=2] [ext_resource path="res://props/portal/portal_placeholder.gd" type="Script" id=1] [ext_resource path="res://fonts/montserrat_extra_bold_48.tres" type="DynamicFont" id=2] @@ -9,6 +9,77 @@ albedo_color = Color( 0.639216, 0.141176, 0.141176, 1 ) [sub_resource type="CylinderShape" id=20] height = 1.0 +[sub_resource type="Animation" id=21] +length = 0.001 +tracks/0/type = "value" +tracks/0/path = NodePath("Label3D:scale") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 0, +"values": [ Vector3( 1, 1, 1 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("Label3D:translation") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 0, +"values": [ Vector3( 0, 6, 0 ) ] +} + +[sub_resource type="Animation" id=22] +resource_name = "shrink" +tracks/0/type = "value" +tracks/0/path = NodePath("Label3D:scale") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 1 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ Vector3( 1, 1, 1 ), Vector3( 0, 0, 0 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("Label3D:translation") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0, 1 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ Vector3( 0, 6, 0 ), Vector3( 0, 4, 0 ) ] +} + +[sub_resource type="Animation" id=23] +resource_name = "up_and_down" +length = 4.0 +loop = true +tracks/0/type = "value" +tracks/0/path = NodePath("Label3D:translation") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 1, 2, 3, 4 ), +"transitions": PoolRealArray( 1, 1, 1, 1, 1 ), +"update": 0, +"values": [ Vector3( 0, 6, 0 ), Vector3( 0, 6.2, 0 ), Vector3( 0, 6, 0 ), Vector3( 0, 5.8, 0 ), Vector3( 0, 6, 0 ) ] +} + [node name="PortalPlaceholder" type="CSGCylinder"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0670445, 0, -135.074 ) radius = 3.0 @@ -29,10 +100,16 @@ shape = SubResource( 20 ) bus = "Sound" [node name="Label3D" type="Label3D" parent="."] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 6.2, 0 ) +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 6, 0 ) pixel_size = 0.025 billboard = 2 text = "Portal" font = ExtResource( 2 ) +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +autoplay = "up_and_down" +anims/RESET = SubResource( 21 ) +anims/shrink = SubResource( 22 ) +anims/up_and_down = SubResource( 23 ) + [connection signal="body_entered" from="Area" to="." method="_on_Portal_entered"] diff --git a/ui/pause.gd b/ui/pause.gd index df2a721f..4c1996a2 100644 --- a/ui/pause.gd +++ b/ui/pause.gd @@ -27,6 +27,9 @@ func _ready(): $MainPause/HBoxContainer/RightContainer/SoundVolumeLabel.text = sound_volume_text % Configuration.get_value("audio", "sound_volume") $MainPause/HBoxContainer/RightContainer/SoundVolumeSlider.value = Configuration.get_value("audio", "sound_volume") + $MainPause/UpgradesContainer/HBoxContainer/MidAirDashCheckButton.pressed = Configuration.get_value("debug", "mid_air_dash") + GameState.upgrades["mid_air_dash"] = Configuration.get_value("debug", "mid_air_dash") + func _on_DrawDistanceSlider_value_changed(value): Configuration.update_setting("graphics", "draw_distance", value) $MainPause/HBoxContainer/LeftContainer/DrawDistanceLabel.text = draw_distance_text % value @@ -107,3 +110,8 @@ func _on_ControlsBackButton_pressed(): func _on_ReloadMapButton_pressed(): GameState.reload_current_scene() pause() + + +func _on_MidAirDashCheckButton_toggled(button_pressed: bool): + Configuration.update_setting("debug", "mid_air_dash", button_pressed) + GameState.upgrades["mid_air_dash"] = button_pressed diff --git a/ui/user_interface.tscn b/ui/user_interface.tscn index befc87dc..2c561ba5 100644 --- a/ui/user_interface.tscn +++ b/ui/user_interface.tscn @@ -64,15 +64,15 @@ custom_constants/separation = 10 alignment = 1 [node name="ResumeButton" type="Button" parent="Pause/MainPause"] -margin_top = 58.0 +margin_top = 33.0 margin_right = 570.0 -margin_bottom = 95.0 +margin_bottom = 70.0 text = "Resume" [node name="HBoxContainer3" type="HBoxContainer" parent="Pause/MainPause"] -margin_top = 105.0 +margin_top = 80.0 margin_right = 570.0 -margin_bottom = 142.0 +margin_bottom = 117.0 size_flags_horizontal = 3 [node name="ToggleFullscreenButton" type="Button" parent="Pause/MainPause/HBoxContainer3"] @@ -89,9 +89,9 @@ size_flags_horizontal = 3 text = "Controls" [node name="HBoxContainer" type="HBoxContainer" parent="Pause/MainPause"] -margin_top = 152.0 +margin_top = 127.0 margin_right = 570.0 -margin_bottom = 334.0 +margin_bottom = 309.0 custom_constants/separation = 10 [node name="LeftContainer" type="VBoxContainer" parent="Pause/MainPause/HBoxContainer"] @@ -190,16 +190,36 @@ text = "mountain_map" items = [ "mountain_map", null, false, 0, null, "test_map", null, false, 1, null ] selected = 0 +[node name="UpgradesContainer" type="VBoxContainer" parent="Pause/MainPause"] +margin_top = 319.0 +margin_right = 570.0 +margin_bottom = 359.0 + +[node name="HBoxContainer" type="HBoxContainer" parent="Pause/MainPause/UpgradesContainer"] +margin_right = 570.0 +margin_bottom = 40.0 + +[node name="MidAirDashCheckButton" type="CheckButton" parent="Pause/MainPause/UpgradesContainer/HBoxContainer"] +margin_right = 76.0 +margin_bottom = 40.0 + +[node name="MidAirDashLabel" type="Label" parent="Pause/MainPause/UpgradesContainer/HBoxContainer"] +margin_left = 80.0 +margin_top = 4.0 +margin_right = 238.0 +margin_bottom = 35.0 +text = "Mid-Air Dash" + [node name="ReloadMapButton" type="Button" parent="Pause/MainPause"] -margin_top = 344.0 +margin_top = 369.0 margin_right = 570.0 -margin_bottom = 381.0 +margin_bottom = 406.0 text = "Reload Map" [node name="HBoxContainer2" type="HBoxContainer" parent="Pause/MainPause"] -margin_top = 391.0 +margin_top = 416.0 margin_right = 570.0 -margin_bottom = 428.0 +margin_bottom = 453.0 size_flags_horizontal = 3 custom_constants/separation = 10 alignment = 1 @@ -263,6 +283,7 @@ text = "Back" [connection signal="value_changed" from="Pause/MainPause/HBoxContainer/RightContainer/MusicVolumeSlider" to="Pause" method="_on_MusicVolumeSlider_value_changed"] [connection signal="value_changed" from="Pause/MainPause/HBoxContainer/RightContainer/SoundVolumeSlider" to="Pause" method="_on_SoundVolumeSlider_value_changed"] [connection signal="item_selected" from="Pause/MainPause/HBoxContainer/RightContainer/MapOptionButton" to="Pause" method="_on_MapOptionButton_item_selected"] +[connection signal="toggled" from="Pause/MainPause/UpgradesContainer/HBoxContainer/MidAirDashCheckButton" to="Pause" method="_on_MidAirDashCheckButton_toggled"] [connection signal="pressed" from="Pause/MainPause/ReloadMapButton" to="Pause" method="_on_ReloadMapButton_pressed"] [connection signal="pressed" from="Pause/MainPause/HBoxContainer2/TitleScreenButton" to="Pause" method="_on_MainMenuButton_pressed"] [connection signal="pressed" from="Pause/MainPause/HBoxContainer2/ExitButton" to="Pause" method="_on_ExitButton_pressed"]