My Bullet class should be removed if it touches the wall, but it doesn't. Here is my code of my Bullet:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | public void act() { move( 5 ); removeP(); removeB(); } public void removeB() { if (isTouching(wall. class )) { removeTouching(Bullet. class ); } } public void removeP() { if (isTouching(player. class )) { removeTouching(player. class ); } } public Bullet() { GreenfootImage image = getImage(); image.scale(image.getWidth() - 60 , image.getHeight() - 60 ); setImage(image); } |