Skip to content

Commit

Permalink
fixed player reset
Browse files Browse the repository at this point in the history
  • Loading branch information
briyoon committed Oct 22, 2021
1 parent 4b7b36e commit 0393c49
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 0 additions & 1 deletion Scripts/EndScreen.gd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ func win(flaps, time):
$BG/Content.text = "You completed the game in %02d:%02d with %d flaps" % [floor(time / 60), int(time)%60, flaps]
visible = true


func _on_MenuReturn_pressed():
$"../MainMenu".return_to_menu()
visible = false
10 changes: 7 additions & 3 deletions Scripts/MainMenu.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
extends Control

func reset_player():
$"../../".total_time = 0
$"../../Player".flaps = 0
$"../../Player".position = $"../../Player".starting_position
$"../../Player".velocity = Vector2.ZERO

func _ready():
$Background/GameSelect.visible = false

Expand All @@ -11,9 +17,7 @@ func _on_Quit_pressed():
get_tree().quit()

func _on_StartGame_pressed():
$"../../".total_time = 0
$"../../Player".flaps = 0
$"../../Player".position = $"../../Player".starting_position
reset_player()
$Background/GameSelect.visible = !$Background/GameSelect.visible

# TODO: fix kill_velocity values, tune stun velocity
Expand Down

0 comments on commit 0393c49

Please sign in to comment.