Hello.
I'm currently doing a Pong game, and I think I got a pretty nice result and I'm close to completing it, but I'm having two problems finalizing it:
- I have a Main Menu scene, with some button options (1P that goes into easy/normal/hard ptions; and a multiplayer option). From this Main Menu scene, the game goes into the Game scene. But I don't know how to change some parameters from some objects in the game, based on what I press on the previous scene (the main menu)
- For example, the main state of the game is what I would consider the "easy" option for 1P. But if I click on the normal or hard option, I don't know how to affect directly the speed of the ball and the speed of the AI on the code.
- There's a similar problem for the 2P option. The main state of the game is with a pretty basic AI, but if I click on the 2P option on the main menu scene, I don't know how to alter the code of the enemy to change it to only a controllable sprite, without my AI code.
- I know how to make a controllable sprite for the second player, or to speed up the ball on every collision, or increase the A.I speed, I just don't know how to do this "exchange" of code based on what I press on the previous scene.
I could avoid all of these questions by having a new scene for all the options (1P/Easy, 1P/Normal, 1P/Hard, and Multiplayer), but I don't think this is a wise choice for organization and optimization.
If it is necessary for me to post my code or my entire project, just let me know, but I didn't post it now since I just want to understand the logic of doing this procedure.
Thanks!
Personally I'm not thrilled at recommending any type of Global variable, but don't yet understand what options are available in gdscript, in terms of data-structures, organization, etc.