gameboy
This commit is contained in:
30
script/Gameboy.cs
Normal file
30
script/Gameboy.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class Gameboy : CanvasLayer
|
||||
{
|
||||
[Export] CharacterBody2D player;
|
||||
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
{
|
||||
}
|
||||
|
||||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void start()
|
||||
{
|
||||
player.Set("pausable", false);
|
||||
this.Visible = true;
|
||||
}
|
||||
|
||||
void stop()
|
||||
{
|
||||
player.Set("pausable", true);
|
||||
this.Visible = false;
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,8 @@ public partial class Player : CharacterBody2D
|
||||
[Export] AudioStream aud_glissemie;
|
||||
[Export] AudioStream aud_voiture;
|
||||
[Export] AudioStream aud_win;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -44,7 +46,7 @@ public partial class Player : CharacterBody2D
|
||||
const float MAX_SUGAR = 100;
|
||||
bool end = false;
|
||||
|
||||
|
||||
bool pausable { get; set; } = true;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
@@ -110,7 +112,7 @@ public partial class Player : CharacterBody2D
|
||||
}
|
||||
|
||||
|
||||
if(Input.IsActionPressed("quit"))
|
||||
if(Input.IsActionPressed("quit") && pausable)
|
||||
{
|
||||
Input.MouseMode = Input.MouseModeEnum.Visible;
|
||||
GetTree().Paused= true;
|
||||
|
||||
Reference in New Issue
Block a user