and since you make the counter be based off of a i++ type variable it can go on indefinatly you could probably insert it through
for i>= 0 i++{
i++
}
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Bullet here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Bullet extends Actor
{
/**
* Act - do whatever the Bullet wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public Bullet()
{
}
public void act()
{
movement();
if (isAtEdge())
{
collidesWithZombie(); getWorld().removeObject(this);
}
}
private boolean collidesWithZombie() {
if ( ! isTouching(Zombies.class)) return false;
{ Greenfoot.playSound("Gunshot.mp3");
removeTouching(Zombies.class);
((Counter)getWorld().getObjects(Counter.class).get(0)).add(1);
return true;
}
}
private void movement()
{
move(6);
if (isAtEdge())
{
World world = getWorld();
if(world != null)
{
world.removeObject(this);
return;
}
}
}
private void repeat()
{
}
}
public void act() {
move(6);
if (isAtEdge() || collidesWithZombie()) getWorld().removeObject(this);
}
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Bullet here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Bullet extends Actor
{
/**
* Act - do whatever the Bullet wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public Bullet()
{
}
public void act()
{
movement();
if (isAtEdge())
{
collidesWithZombie(); getWorld().removeObject(this);
}
}
private boolean collidesWithZombie() {
if ( ! isTouching(Zombies.class)) return false;
{ Greenfoot.playSound("Gunshot.mp3");
removeTouching(Zombies.class);
((Counter)getWorld().getObjects(Counter.class).get(0)).add(1);
return true;
}
}
private void movement()
{
move(6);
if (isAtEdge())
{
World world = getWorld();
if(world != null)
{
world.removeObject(this);
return;
}
}
}
private void repeat()
{
}
}
public void act() {
move(6);
if (isAtEdge() || collidesWithZombie()) getWorld().removeObject(this);
}
public void act() {
if (getWorld() == null) return;
move(6);
if (isAtEdge() || collidesWithZombie()) getWorld().removeObject(this);
}
public void act() {
move(6);
if (isAtEdge() || collidesWithZombie()) getWorld().removeObject(this);
}
import greenfoot.*;
public class Bullet extends Actor
{
public void act() {
move(6);
if (isAtEdge() || collidesWithZombie()) getWorld().removeObject(this);
}
private boolean collidesWithZombie() {
if ( ! isTouching(Zombies.class)) return false;
Greenfoot.playSound("Gunshot.mp3");
removeTouching(Zombies.class);
((Counter)getWorld().getObjects(Counter.class).get(0)).add(1);
return true;
}
}