letsgamedev / Suffragium

A game developed in a democratic cycle.
GNU Affero General Public License v3.0
51 stars 21 forks source link

add menu at the end of a game with a restart button #63

Closed Joshix-1 closed 2 years ago

Joshix-1 commented 2 years ago

Description

I've added a better menu at the end of the games, that allows to restart or return to the menu.

image

Type of change

Environment

Please describe your environment and remove nonapplicable environment information from this section.

Testing

I played multiple games and looked at how the menu behaved.

Checklist

ASecondGuy commented 2 years ago

Your title has a typo. I think calling end_game more than once should be possible. If not every of the potentially hundreds of games needs to worry about that. If the GameManager just ignored those calls this problem is solved for good.

Joshix-1 commented 2 years ago

GameManager currently should ignore the calls

If it is called the second time it doesn't know the current game and returns early

ASecondGuy commented 2 years ago

Then why is this needed?

Joshix-1 commented 2 years ago

I don't know it. I just expierienced the bug, and that fixed it

Numenter commented 2 years ago

Then why is this needed?

I don't know it. I just expierienced the bug, and that fixed it

Game:end_game -> GM:restart -> NewGame:Hallo -> OldGame:end_game -> OldGame:queue_free() Something like that.

b7g commented 2 years ago

There is interference between the pause menu and the end game menu.

https://user-images.githubusercontent.com/74007114/177458995-e8b46c26-8624-4b8a-9681-b59c1d205a4a.mp4

Joshix-1 commented 2 years ago

fixed that. The end_game_menu doesn't display anymore after pressing restart in the pause menu

b7g commented 2 years ago

When closing the window I still get this error:

E 0:00:26.416   add_child: Parent node is busy setting up children, add_node() failed. Consider using call_deferred("add_child", child) instead.
  <C++-Fehler>  Condition "data.blocked > 0" is true.
  <C++-Quellcode>scene/main/node.cpp:1135 @ add_child()
  <Stacktrace>  game_manager.gd:68 @ end_game()
                game_manager.gd:29 @ _notification()

and it halts with this message:

Invalid set index 'text' (on base: 'Nil') with value of type 'String'.

The trace:

end_game_menu.gd:34 - at function: show
game_manager.gd:69 - at function: end_game
game_manager.gd:29 - at function: _notification
Joshix-1 commented 2 years ago

Should be fixed now too

Joshix-1 commented 2 years ago

Rebased all the changes and squashed them into one commit.