Can you make a VAR public to two files


Is there a way I can declare a variable such as var public score:Int = 0 in such a way that a 2nd file in my project can read an manipulate it without sending that variable to the 2nd file in a function?


You can declare it static. public static var score:Int = 0; If you declare in class G.hx as example, you can access it with G.score


That is exactly what I’ve been missing! Thank you so much.

(Will this same concept work with functions as well?)




Great, thanks for your time. You both were a big help.