Hello!
I am having a problem with my shooting code.
it is giving incompatible types at the if(direction = 0) parts.
What I want to do is make my beam move left if my player is facing left, and make it move right when he faces to the right.
I tried doing this by making a variable named direction, and changing it when he looks the other way.
thanks in advance.
public class Beam extends Mover
{
public int direction = 0;
public int directionL = 180;
public void act()
{
fireTheBeam();
shootWhere();
}
private void fireTheBeam()
{
if(direction = 0)
{
move(10);
}
if(direction = 180)
{
move(-10);
}
}
private void shootWhere()
{
if(Greenfoot.isKeyDown("right"))
{
direction = 0;
}
if(Greenfoot.isKeyDown("left"))
{
directionL = 180;
}
}
}

