放弃方案拟订。 学会发展类似于所谓的断肢游戏。 如何运作
你们有一套砖子,用球和篮子打。
陷入这种情况
Whenever i miss the ball, itl take me to the else loop where im sending "Game over" message. Instead i want the ball back again, and the other left over bricks to hit.
Here s the snippet Java Code:
public void paint(Graphics g) {
super.paint(g);
if (ingame) {
g.drawImage(ball.getImage(), ball.getX(), ball.getY(),
ball.getWidth(), ball.getHeight(), this);
g.drawImage(paddle.getImage(), paddle.getX(), paddle.getY(),
paddle.getWidth(), paddle.getHeight(), this);
for (int i = 0; i < 30; i++) {
if (!bricks[i].isDestroyed())
g.drawImage(bricks[i].getImage(), bricks[i].getX(),
bricks[i].getY(), bricks[i].getWidth(),
bricks[i].getHeight(), this);
}
} else {
Font font = new Font("Verdana", Font.BOLD, 18);
FontMetrics metr = this.getFontMetrics(font);
g.setColor(Color.BLACK);
g.setFont(font);
g.drawString(message,
(Commons.WIDTH - metr.stringWidth(message)) / 2,
Commons.WIDTH / 2);
}
Toolkit.getDefaultToolkit().sync();
g.dispose();
}
提前感谢: