In a game that I am making I have two different mousePressed()
methods, one for single fireing and one for auto fireing, If you get a automatic weapon it will change the mousePressed()
methid from the one for single fireing to the one for automatic fire.
Later on when you lose the automatic weapon it will cahnge back to the mousePressed()
for single fireing (I do this by having two MouseAdapter
s and the using addMouseListener
and removeMouseListener
).
The problem is that if you keep holding down the mouse as you lose your aoutomatic weapon you will still shoot automatically until you release the mouse and then press it again and the it will switch to the single fireing mousePressed()
.
How would I make it so that it will switch the MouseAdapter
while the mouse is being pressed?