public class Paddle2 extends Actor
{
private boolean mouseKeyDown = false;
public void act() {
if (!mouseKeyDown && Greenfoot.mousePressed(null)) {
mouseKeyDown = true;
}
else if (mouseKeyDown && Greenfoot.mouseClicked(null)) {
mouseKeyDown = false;
}
if (mouseKeyDown) {
MouseInfo mouse = Greenfoot.getMouseInfo();
if (mouse != null) {
setLocation(mouse.getX(), mouse.getY());
}
}
Actor puck = getOneIntersectingObject(Puck.class);
if (puck != null)
{
Puck.setSpeed(7);
}
}
}