Hey guys! Needed a bit of guidance on what to do with this... I had this code in my program and it returned the error shown in the title. Help?
PS: It was in the directionCheck() method
import greenfoot.*;
/**
* Write a description of class Skeleton here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Skeleton extends Actor
{
private int health;
private int directionY;
private int directionX;
/**
* Act - do whatever the Skeleton wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
directionCheck();
move();
healthCheck();
attack();
deadCheck();
}
public void directionCheck()
{
if (PlayerChar.getX() > getX)
{
directionX = (1);
}
if (PlayerChar.getX() < getX)
{
directionX = (2);
}
if (PlayerChar.getY() > getY)
{
directionY = (1);
}
if (PlayerChar.getY() < getY)
{
directionY = (2);
}
}
public void move()
{
if (directionX = (1))
{
setLocation (1,0);
}
if (directionX = (2))
{
setLocation (-1,0);
}
if (directionY = (1))
{
setLocation (0,1);
}
if (directionY = (2))
{
setLocation (0,-1);
}
}
public void healthCheck()
{
if (health = (0))
{
health = (3);
}
//Insert collision code here.
}
public void attack()
{
if (health = (4))//collision code with player
{
Main_World.playerHealth--;
}
}
public void deadCheck()
{
if (health = (4))//collision code with sword
{
health--;
}
if (health = (4))//collision code with arrow
{
health--;
}
if (health = (1))
{
getWorld.removeObject(this);
}
}
}

