In this game that I made, there are cars that run over people. I would like to make the image switch from the original to a different image when a car collides with it. Could someone help please?


setPaintOrder(Car.class, Car2.class);
if (Greenfoot.isKeyDown("enter")) { Greenfoot.start(); }
if (person != null) { getWorld().addObject(new Dead(), person.getX(), person.getY()); getWorld().removeObject(person); Greenfoot.playSound("splat.wav"); }