Fix a few bugs, add esc to exit table

This commit is contained in:
Sofia 2024-08-20 15:28:35 +03:00
parent 08dc84b343
commit e20c07cf84
3 changed files with 17 additions and 8 deletions

View File

@ -91,7 +91,8 @@ material = SubResource("ShaderMaterial_u26td")
[node name="HUD" parent="." node_paths=PackedStringArray("Player") instance=ExtResource("7_g7tfv")]
Player = NodePath("../Player")
[node name="PauseMenu" parent="." instance=ExtResource("11_lav3p")]
[node name="PauseMenu" parent="." node_paths=PackedStringArray("Table") instance=ExtResource("11_lav3p")]
Table = NodePath("../table")
[node name="BlueprintRenderingViewport" type="SubViewport" parent="."]
msaa_3d = 3

View File

@ -52,6 +52,11 @@ namespace Gmtk24 {
if (!IsEnabled)
return;
if (@event.IsAction("toggle_pause_menu")) {
SetEnabled(false);
GetViewport().SetInputAsHandled();
}
if (@event.IsActionPressed("drag_orbit"))
Input.MouseMode = Input.MouseModeEnum.Captured;
if (@event.IsActionReleased("drag_orbit"))
@ -75,13 +80,13 @@ namespace Gmtk24 {
EmitSignal(SignalName.BlockRelease, HeldBlock, (uint)BlockReleaseType.Place);
HeldBlock = null;
}
}
if (@event.IsActionPressed("rotate_block_right")) {
HeldBlock.RotateY(RotateAmt);
}
if (@event.IsActionPressed("rotate_block_left")) {
HeldBlock.RotateY(-RotateAmt);
if (@event.IsActionPressed("rotate_block_right")) {
HeldBlock.RotateY(RotateAmt);
}
if (@event.IsActionPressed("rotate_block_left")) {
HeldBlock.RotateY(-RotateAmt);
}
}
}

View File

@ -16,6 +16,9 @@ namespace Gmtk24 {
[Export]
public BaseButton CameraInvertY;
[Export]
public Table Table;
private bool Opened = false;
public override void _Ready() {
@ -34,7 +37,7 @@ namespace Gmtk24 {
}
public override void _Input(InputEvent @event) {
if (@event.IsActionPressed("toggle_pause_menu")) {
if (@event.IsActionPressed("toggle_pause_menu") && (!Table.Orbit?.IsEnabled ?? true)) {
if (Opened) {
Close();
} else {