Ok, so this is a pretty good start and thanks for posting your full code correctly. Let's make a few changes to start developing habits that will make this a little easier for you.
Before you consider the revisions, note that the IR stuff has been left out for now. One step at a time. I think you want to use an IR remote as a blaster to take the place of the fire button? Is that right? Also, i didn't see the reset button but let's leave that for now, too.
Final note: I didn't read any other code suggestions here before posting. My suggestions are standalone, probably not the best among the suggestions but without further ado:
// #include <EEPROM.h> get rid of this for now. One stage at a time in game building // let's do something fun since you seem to be using Uno R4 #include "Arduino_LED_Matrix.h" // Include the LED_Matrix library, more here: https://docs.arduino.cc/tutorials/uno-r4-wifi/led-matrix/#sequencedone #include <IRremote.hpp> ArduinoLEDMatrix matrix; // Create an instance of the ArduinoLEDMatrix class // const int for things like pin assignments that will never change const int irTx = 2; // naming conventions help with longer code, good habit to get into const int irRx = 3; const int fireButton = 4; const int reloadButton = 5; const int resetButton = 6; const int rLed = 7; const int gLed = 8; // the declarations below are ok. int addr = 0; int fire = 0; int reset = 0; int ammo = 30; int hp = 0; int pews = 0; int reload = 0; // lots of white space lines don't help; I deleted some void setup() { Serial.begin(115200); // 9600? Let's go faster, it's 2025 Serial.println("IR blaster game v1.0"); // so you always know what's loaded on the board matrix.begin(); // Initialize the LED matrix pinMode(irTx, OUTPUT); //transmitter pinMode(irRx, INPUT); //receiver pinMode(fireButton, INPUT_PULLUP); //no need for external resistors with pushbuttons pinMode(reloadButton, INPUT_PULLUP); pinMode(resetButton, INPUT_PULLUP); pinMode(gLed, OUTPUT); //green LED pinMode(rLed, OUTPUT); //red LED // a for loop is a great way to repeat something, say 5 times or however much you like for (int i = 0; i < 5; i++) { digitalWrite(gLed, HIGH); // let's toggle these to know they work digitalWrite(rLed, HIGH); delay(250); digitalWrite(gLed, LOW); digitalWrite(rLed, LOW); delay(250); } // end of for loop that toggles LEDs digitalWrite(gLed, LOW); // let's init these to off digitalWrite(rLed, LOW); } // if () << what was the idea here? It's between setup and loop, so...? Delete it void loop() { // you need some sort of debouncing of buttons and you'll see why in Serial fire = digitalRead(fireButton); reload = digitalRead(reloadButton); // remember INPUT_PULLUP below? The catch is your logic must be reversed so keep that in mind if (reload == LOW) { // was HIGH, changed to LOW because INPUT_PULLUP // digitalWrite(7, HIGH); -- which was this one again? digitalWrite(rLed, HIGH); // Oh yeah, red - isn't that easier to follow? Let's get the LED lit right away matrix.clear(); matrix.loadFrame(LEDMATRIX_EMOJI_HAPPY); ammo = 30; if (ammo >= 30) // this will keep ammo always at 30, I think you mean > so magazine can't be more ammo = 30; Serial.println("reloaded"); delay(100); digitalWrite(rLed, LOW); // and turn it back off } if (fire == LOW) { digitalWrite(rLed, HIGH); matrix.loadFrame(LEDMATRIX_CHIP); if (ammo > 0) { pews++; ammo--; } else if (ammo <= 0) { matrix.loadFrame(LEDMATRIX_DANGER); ammo = 0; } Serial.print("pew, "); Serial.print(pews); Serial.print(" ammo, "); Serial.println(ammo); delay(50); digitalWrite(rLed, LOW); matrix.clear(); } } //loop end