path car
This commit is contained in:
@@ -10,7 +10,10 @@ public partial class Player : CharacterBody2D
|
||||
[Export] TextureProgressBar bar;
|
||||
[ExportGroup("controls")]
|
||||
[Export] Control menu;
|
||||
|
||||
[Export] float minute_part_second = 1;
|
||||
[Export] Label time;
|
||||
float minute;
|
||||
int heure = 18;
|
||||
|
||||
|
||||
|
||||
@@ -35,6 +38,14 @@ public partial class Player : CharacterBody2D
|
||||
|
||||
}
|
||||
|
||||
minute += minute_part_second * (float) delta;
|
||||
|
||||
if (minute >= 60)
|
||||
{
|
||||
minute = 0;
|
||||
heure +=1;
|
||||
}
|
||||
UpdateTime();
|
||||
|
||||
Vector2 direction = Input.GetVector("left", "right", "up", "down");
|
||||
direction = direction.Normalized();
|
||||
@@ -85,4 +96,9 @@ public partial class Player : CharacterBody2D
|
||||
|
||||
Position = Position.Round();
|
||||
}
|
||||
|
||||
void UpdateTime()
|
||||
{
|
||||
time.Text = string.Format("{0:D2}:{1:D2}", heure, (int)Math.Floor(minute));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user