So I have an actor that has a method called "shot()" that won't get called for some reason. Does anyone see something wrong with my code?
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class Pirahna here. * * @author (your name) * @version (a version number or a date) */ public class Pirahna extends Actor { private int speed = 4; private int leftTurn = 910; private int rightTurn = 1020; private int shotTime = 20; public void act() { shot(); setLocation(getX() + speed, getY() ); if (atTP()) { speed = - speed; } switchPic(); } public void shot() { shotTime--; if (shotTime == 0) { getWorld().addObject(new Orb(), getX() -50, getY()); } shotTime = 20; } public void switchPic() { if(speed == 4 && !isTouching(Ketchup.class) || speed == 4 && !isTouching(Musturd.class)) { setImage("pirahna1.png"); } if(speed == -4 && !isTouching(Ketchup.class) || speed == -4 && !isTouching(Musturd.class)) { setImage("pirahna.png"); } if(speed == 4 && isTouching(Ketchup.class) || speed == 4 && isTouching(Musturd.class)) { setImage("pirahna3.png"); } if(speed == -4 && isTouching(Ketchup.class) || speed == -4 && isTouching(Musturd.class)) { setImage("pirahna2.png"); } } public boolean atTP() { return (getX() <= leftTurn || getX() >= rightTurn); } }