Hi, is there a way to control the movement of two objects using 1 class? With the code below, when I press the up arrow key both of the paddles move so is it possible for the up and down arrow key to control one of the objects and the 'w' and 's' keys to control the movement of the other object using the same class I have below?
public class Paddle extends Actor
{
public Paddle()
{
GreenfootImage pad = new GreenfootImage(10, 100);
pad.fill();
setImage(pad);
}
*/
public void act()
{
if(Greenfoot.isKeyDown("up")) {
setLocation(getX(),getY()-5);
}
if(Greenfoot.isKeyDown("down")) {
setLocation(getX(),getY()+5);
}
}
}

