7-8-25 00:017-8-25 00:017-8-25 00:017-8-25 00:017-8-25 00:017-8-25
00:017-8-25 00:01
This commit is contained in:
10
Main.cs
10
Main.cs
@@ -12,13 +12,14 @@ public partial class Main : Node
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
NewGame();
|
||||
//NewGame();
|
||||
}
|
||||
|
||||
public void GameOver()
|
||||
{
|
||||
GetNode<Timer>("MobTimer").Stop();
|
||||
GetNode<Timer>("ScoreTimer").Stop();
|
||||
GetNode<Hud>("HUD").ShowGameOver();
|
||||
}
|
||||
|
||||
public void NewGame()
|
||||
@@ -30,12 +31,19 @@ public partial class Main : Node
|
||||
player.Start(startPosition.Position);
|
||||
|
||||
GetNode<Timer>("StartTimer").Start();
|
||||
|
||||
var hud = GetNode<Hud>("HUD");
|
||||
hud.UpdateScore(_score);
|
||||
hud.ShowMessage("Get Ready!");
|
||||
|
||||
GetTree().CallGroup("mobs", Node.MethodName.QueueFree);
|
||||
}
|
||||
|
||||
// We also specified this function name in PascalCase in the editor's connection window.
|
||||
private void OnScoreTimerTimeout()
|
||||
{
|
||||
_score++;
|
||||
GetNode<Hud>("HUD").UpdateScore(_score);
|
||||
}
|
||||
|
||||
// We also specified this function name in PascalCase in the editor's connection window.
|
||||
|
||||
Reference in New Issue
Block a user