import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Goku here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Goku extends Actor
{
public int gokuRotation;
boolean touchingMinion = false;
public static int gokuX, gokuY;
/**
* Act - do whatever the Goku wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
move(4);
shoot();
gokuRotation = getRotation();
checkKeys();
gokuX = getX();
gokuY = getY();
}
public void checkKeys()
{
if (Greenfoot.isKeyDown("a"))
{
turn(-5);
}
if (Greenfoot.isKeyDown("d"))
{
turn(5);
}
}
public void shoot()
{
if(Greenfoot.getMouseInfo() != null)
{
if(Greenfoot.getMouseInfo().getButton() == 1)
getWorld() .addObject(new Bullet(gokuRotation), getX(), getY());
}
}
public boolean isTouching()
{
return getOneIntersectingObject(Minion.class) != null;
}
}