How I can have a magazine to gun?
Help plz.
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) public class Soldier extends Actor { private int soldierSpeed = 3; private GreenfootImage soldierWalk1 = new GreenfootImage("Roboani1.png"); private GreenfootImage soldierWalk2 = new GreenfootImage("Roboani2.png"); private GreenfootImage soldierWalk3 = new GreenfootImage("Roboani3.png"); private int animationCount = 0; private int frame = 1; private int mouseX; private int mouseY; public static int currentX; public static int currentY; public static int currentRot; int Ammo = 10; int reloadDelay = 100; public void act() { move(); faceMouse(); shoot(); currentX = getX(); currentY = getY(); currentRot = getRotation(); } public void move() { animationCount ++; if(Greenfoot.isKeyDown("w")) { move(3); if(animationCount % 8 == 0) { animationWalk(); } } else if(Greenfoot.isKeyDown("s")) { move(-3); if(animationCount % 8 == 0) { animationWalk(); } } else { setImage(soldierWalk1); } } public void animationWalk() { if(frame == 1) { setImage(soldierWalk1); frame = 2; } else if(frame == 2) { setImage(soldierWalk2); frame = 3; } else if(frame == 3) { setImage(soldierWalk3); frame = 1; } } public void faceMouse() { if(Greenfoot.getMouseInfo() != null) { mouseX = Greenfoot.getMouseInfo().getX(); mouseY = Greenfoot.getMouseInfo().getY(); turnTowards (mouseX, mouseY); } } public void shoot() { if (Greenfoot.isKeyDown("space") && Ammo > 0) { if(Greenfoot.getMouseInfo() != null) { if(Greenfoot.getMouseInfo().getButton() == 1) { getWorld().addObject(new Bullet(), getX(), getY()); Ammo--; } if (Ammo <= 0) { reloadDelay--; if (reloadDelay <= 0) { Ammo = 10; reloadDelay = 100; } } } } } }