Add android build preset and fix pausing
This commit is contained in:
3 files changed
+247
-6
No files matched your search
+16
-4
@@ -6,7 +6,6 @@ public partial class Player : Node2D {
|
||||
private bool doLeft = false;
|
||||
private bool doRight = false;
|
||||
private bool doJump = false;
|
||||
private bool doPause = false;
|
||||
|
||||
public override void _Ready() {
|
||||
var ScreenSize = GetViewport().GetVisibleRect().Size;
|
||||
@@ -80,7 +79,7 @@ public partial class Player : Node2D {
|
||||
Globals.BerrySpeed = Globals.DefaultBerrySpeed * 2f;
|
||||
}
|
||||
|
||||
if (Input.IsActionJustPressed("EscapeKey") || doPause) {
|
||||
if (Input.IsActionJustPressed("EscapeKey")) {
|
||||
if (!Globals.IsPaused) {
|
||||
PackedScene PauseMenu = GD.Load<PackedScene>("res://Prefabs/PauseMenu.tscn");
|
||||
|
||||
@@ -112,6 +111,19 @@ public partial class Player : Node2D {
|
||||
private void MobileRightMoveUp() => doRight = false;
|
||||
private void MobileJumpMoveDown() => doJump = true;
|
||||
private void MobileJumpMoveUp() => doJump = false;
|
||||
private void MobilePauseDown() => doPause = true;
|
||||
private void MobilePauseUp() => doPause = false;
|
||||
private void MobilePausePressed() {
|
||||
PackedScene PauseMenu = GD.Load<PackedScene>("res://Prefabs/PauseMenu.tscn");
|
||||
|
||||
Control PauseMenuInstance = PauseMenu.Instantiate<Control>();
|
||||
|
||||
PauseMenuInstance.Position = new Vector2(x: 0, y: 0);
|
||||
PauseMenuInstance.ZIndex = -1;
|
||||
|
||||
GetNode<CanvasLayer>("/root/Game/CanvasLayer").AddChild(PauseMenuInstance);
|
||||
Globals.IsPaused = true;
|
||||
|
||||
AudioStreamPlayer MusicPlayer = GetNode<AudioStreamPlayer>("/root/Game/MusicPlayer");
|
||||
|
||||
MusicPlayer.StreamPaused = !MusicPlayer.StreamPaused;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user