Hello, I recently started on a project and watched some Youtube tutorials, and I am getting stuck on how to turn my bullet to the left side. It only shoots to the right even if I change the direction. I need some help please!
My shooting methods for my character are :
and this is my shoot right and shoot left sub class
public boolean shooting()
{
if(Greenfoot.isKeyDown("x") && ShootingCounter <= 0 && facing == 1)
{
getWorld().addObject(new ShootRight(), getX(), getY());
ShootingCounter = 100;
return true;
}
return false;
}
public boolean shooting2()
{
if(Greenfoot.isKeyDown("c") && ShootingCounter <= 0 && facing == -1)
{
getWorld().addObject(new ShootLeft(), getX(), getY());
ShootingCounter = 100;
return true;
}
return false;
}private int shootingSpeed = 8;
/**
* Act - do whatever the ShootRight wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
fly();
killBadGuys();
}
public void fly()
{
setLocation(getX() + shootingSpeed, getY());
}