Matrix use for Pinball development

In my project I have approx. 64 switches. So, I decided that a matrix might be the answer to accommodating that many switches. Problem is most are temporary impulse and a few are toggle style. It's those few that I will am having a problem figuring out how to handle... I currently don't have the code written for those, but I imagined I could write a latch to handle them.... but they will stay latched and I think that will become a problem for the rest of my switches. So, I was thinking maybe some sort of interrupt is necessary? Looking for some encouragement....

Welcome to the forum

Each switch in the matrix will be momentary but a variable associated with those that need to act as toggles can alternate between 2 states when the switch is pressed

Use the value of those variables when you need to know whether the associated switch should be regarded as either on or off

What's the minimum lenght of them?

thank you, that is what I was thinking. I will give that a shot on a smaller matrix example first and then scale up.

Do you mean physically or this is the behavior you want in the code?

physically they are all contact leaf switches. its a multi ball game with ball locks. so when the ball creates contact the switch is toggled on... and stays in this state for any period of time until the ball is triggered to release.

Can you explain this better?

Does the switch capture the ball somehow, thereby keeping the switch closed? How does the ball get released again so that the switch can open again?

74HC595 input shift register