Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+8 votes

I want to be able to change the window from my start screen to the rest of the game within a button press

asked in CSC380Jan2024 by (1 point)

1 Answer

+2 votes
 
Best answer

First, make sure you have a reference to your game's viewport. You can access it using get_viewport(). Set an initial scale for your viewport. This can be done in the _ready() function or wherever is appropriate in your script. Create a function to change the viewport scale based on a button press. For example, if you want to toggle between the start screen size and full game size, connect this function to a button press or any other input event you prefer. For example, if you want to change the scale when the user presses a specific key. with the code:

       if Input.is_action_pressed(...):
             toggle_viewport_scale()
answered by (1 point)
selected by
+1

This is excellent thank you

...