I’m using XNA (C#) to develop a 2D platformer.
I was wondering for the best way to handle holding down a specific button. For example the more you hold down the larger the laser beam gets.
So far, since I’m already using the input mechanism that holds the 2 last states of the Keyboard, I can make an extra check each update cycle to increase the duration. But, this approach is rather limited since it only handles a specific button (fire button i.e.) and it should do the trick, but i was wondering if maybe there’s a more general solution to the problem.
Generic method