Thatās the code iām currently working on. I need to reduce the amount of global variables and create more passing arguments but iām not really sure how to go about it.
Have a look at this tutorial: https://processing.org/tutorials/objects/
Then attempt to make some changes. If you run into a road block, ask here and provide your attempt.
You can format your code by using the </> button when you paste some in the forum. Try and edit your post !
As for your problem why do you need to get rid of those global variables ? In your case, since you are using them in draw, you canāt really do otherwise.
You can use classes as @kfrajer mentioned to order your code a bit more but youāll still have some global variables.
I had already attempted to move variables around within functions first and nothing seemed to work so I moved them all to global.
I donāt technically HAVE to, but itās for a school project and in order for me to get the maximum grade possible I need to eliminate global variables and use passing arguments in my functions.
drawWin() and printWin() are 2 new functions I added. In printWin if I try to call the variables declared in drawWin, I get an error stating āThe variable ādrawWinā does not existā. Of course it doesnāt exist because itās not a variable.
Also yes I know I donāt have a return for printWin just yet. I was starting to set it up til i ran into the error stated.
I know about scoping but thatās why iām confused Even with what you tell me iām not sure how I can do that with my code. Itās getting difficult to think about this code due today. with all the variables declared in global, iām not sure how to make those available only in the functions that theyāre used in.