game
This commit is contained in:
@@ -18,6 +18,7 @@ public partial class Player : CharacterBody2D
|
||||
[Export] Sprite2D over;
|
||||
[Export] CanvasLayer gameover;
|
||||
[Export] AudioStreamPlayer audio;
|
||||
[Export] CanvasLayer gameboy;
|
||||
float minute;
|
||||
int heure = 18;
|
||||
|
||||
@@ -47,6 +48,9 @@ public partial class Player : CharacterBody2D
|
||||
bool end = false;
|
||||
|
||||
bool pausable { get; set; } = true;
|
||||
|
||||
bool gam = false;
|
||||
float mini_time = 0;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
@@ -58,15 +62,25 @@ public partial class Player : CharacterBody2D
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
Vector2 velocity = Velocity;
|
||||
|
||||
|
||||
if (gam == true && mini_time < 0.5) mini_time += (float)delta;
|
||||
if (gam == true && mini_time >= 0.5) gam = false;
|
||||
//GD.Print(gam, mini_time);
|
||||
if (end == false)
|
||||
{
|
||||
sugar -= (float)delta / sugar_speed;
|
||||
}
|
||||
}
|
||||
|
||||
if (Input.IsActionJustPressed("game"))
|
||||
{
|
||||
mini_time = 0;
|
||||
gam = true;
|
||||
anim.Play("game");
|
||||
gameboy.Call("start");
|
||||
}
|
||||
|
||||
bar.Value = sugar;
|
||||
|
||||
bar.Value = sugar;
|
||||
|
||||
if(sugar <= 5)
|
||||
{
|
||||
@@ -134,7 +148,7 @@ public partial class Player : CharacterBody2D
|
||||
{
|
||||
anim.Play("up");
|
||||
}
|
||||
else
|
||||
else if (gam == false)
|
||||
{
|
||||
anim.Play("idle");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user