i have aproblem, when u run over a bad guy he turns into a pile of blood, but when you. run one over they all turn into blood puddles
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) import java.util.List; /** * Write a description of class npc here. * * @author (your name) * @version (a version number or a date) */ public class npc extends player { static boolean dead = false; static int cash; int once = 0; /** * Act - do whatever the npc wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { if (dead == true) { cash = Greenfoot.getRandomNumber(10); spawncash(cash); } if(isTouching(player.class)) { if(driving() == true) { setImage("button-red.png"); dead = true; getWorld().setPaintOrder(player.class,npc.class,cash.class); } if(driving() == false) { if(dead == false){ setLocation(getX()-4,getY()); } if(dead == true){ //nothing } } } } void spawncash(int ammount) { if (once == 0){ for (int i = 0; i <= ammount; i++) { getWorld().addObject(new cash(), getX(), getY()); } once = 1; } } public static boolean isdead() { return dead; } }