Friday, February 17, 2017

Learning Godot Day 4

     Today I was successful in making a pause function when a player reaches 5 points, this is simply done by creating a new if statement and adding a true false statement looking for a player to have a score of 5 or greater, and if so adding the line of code "get_tree().set_pause(true)" this pauses everything in the game excluding anything that is white listed in the editor.
      The code here also adds a text when a player wins depending on which player was victorious and displays it on the screen. I also made it so that the color of the text matches the same color of the player who won. I also imported a custom text since the engine does not support a way to up/down scale a font without importing it so I decided to try that as well to be able to make a large text.
     Settings of importing a custom text is above.
     This is the result, the code also hides both score keeping labels to make a cleaner looking win screen, tomorrow I will attempt to create a prompt in text that prompts either player to hit a key to restart, and then try to follow through with the prompts words by coding a restart function.

No comments:

Post a Comment