I am having issues with making an automatic weapon which is activated when the mouse is pressed. I have used the "while" code and other codes/ways to program this but either the gun is semi-automatic no matter what (when I hold the mouse button only 1 bullet is shot) or greenfoot just freezes and I have to restart it. And I will add a delay so there isn't a billion balls flying once this works.
1 2 3 4 5 6 7 | if (Greenfoot.mouseClicked( null )) var MouseInfo mouse = Greenfoot.getMouseInfo() int x = mouse.getX() int y = mouse.getY() Bullet bullet = new Bullet() getWorld().addObject(bullet,getX(),getY()) bullet.turnTowards(x,y) |