Hi, I'm creating a game where there is a top down player who yields a machine gun, I want it so that if the mouse is HELD down then it will fire, I don't want to use click since I don't want the player to click for every time that they want to shoot. My current code is:
Any help will be greatly appreciated
1 2 3 4 5 6 7 8 9 10 11 12 | boolean mouseIsDown; if (mouse != null ){ if (Greenfoot.mousePressed( this )) mouseIsDown = true ; else if (Greenfoot.mouseClicked( this )) mouseIsDown = false ; if (mouseIsDown){ /** make a bullet **/ weapCounter = 0 ; } } } |