Something really helpful for that is a programming paradigm called Object Oriented programming. It might take a bit to write my own tutorial for it, so I’ll link you some great ones made by other programmers. It’s GREAT to learn, especially in game dev. Helps keep your code clean and organized into individual containers that are applied to objects you want to use.