English 中文(简体)
断裂游戏(当冲出时,我想球再次击中剩余的砖)
原标题:Breakout game ( When im out, i want the ball again to hit the remaining bricks)

放弃方案拟订。 学会发展类似于所谓的断肢游戏。 如何运作

你们有一套砖子,用球和篮子打。

陷入这种情况

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();
   }

提前感谢:

问题回答

(1) 使用油漆委员会

2) Don t destry 图表作为论据通过

3) 守则应等于起步法;在游乐场内移动球并重新开始。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签