Best way to debug?

So, I have around 26 files for my game, and I just went through updating them so that it’s more object oriented and not hardcoded.

I thought everything was good, i made sure there were no infinite loops, and when i start the game up everything loads in, but after a couple of seconds it freezes and acts as if it’s stuck in an infinite loop.

I also noticed when i start it up, I can move my player around, but I can’t shoot.

Pretty much, I just shoot by pressing the M key.

When I click M, it runs currentWeapon.attack()

the currentWeapon is made in an inherited class, the Creature constructor.

Pretty much, I needed to save the “shooter” when I create the weapon, so I pass “this” in the arguments for the weapon, and within the weapon I use that for the x,y,width,height, and direction of the creature. (Where to spawn the bullet the weapon shoots). This worked when I hardcoded everything, but I’m wondering could this issue of the game freezing be cause because of how I create the weapon/Pass the creature? I also wonder if I pass it through the constructor, would that mean the data is never updated. Cause i set “this” to a local variable in the weapon. I don’t really know what else to do unless I need to pass the creature every time I want to attack/draw.

MY question though is, what’s the best way to find the issue for something like this? I could see when you have a large game with 100+ files… it may get kinda tricky to fix an issue like this.