Hey guys! Need a bit of help with my game I am creating. Trying to create a "blade" object that flies out of your character when you push a button. Here is my current code:
The problem is that this code below is preventing the "blade" from moving.
This code is in every direction, including "w", "a", "s", and "d". Please help!
public void rangedAttack()
{
if (Greenfoot.isKeyDown("o"))
{
Ranged attack = new Ranged();
getWorld().addObject(attack, getX(), getY());
}
}if (Greenfoot.isKeyDown("s"))
{
int x = getX();
int y = getY();
int ny = getY()+2;
setLocation(x,ny) ;
if (getOneIntersectingObject(null) != null)
{
setLocation(getX(), getY()-2);
}
charImage = new GreenfootImage("IMG_1190.PNG");
}

