平顶山哪儿有教儿童轮滑入门视频教程的,大神大神快来

大神大神快来帮忙,那么问题在哪,求指教【java吧】_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:677,275贴子:
大神大神快来帮忙,那么问题在哪,求指教收藏
代码如下:public class BirdGame extends JPanel {BColumn column1,column2;GBufferedI//游戏状态public static final int START = 0;public static final int RUNNING = 1;public static final int GAMEOVER = 2;BufferedImage gameOverIBufferedImage startI//分数//初始化BirdGame的属性变量public BirdGame() throws Exception{state = START;startImage = ImageIO.read(getClass().getResource(&image/start.png&));gameOverImage = ImageIO.read(getClass().getResource(&image/gameOver.png&));score = 0;bird = new Bird();column1 = new Column(1);column2 = new Column(2);ground = new Ground();background = ImageIO.read(getClass().getResource(&image/bg.png&));}//“重写(修改)”paint方法实现绘制public void paint(Graphics g){g.drawImage(background, 0, 0, null);g.drawImage(column1.image,column1.x-column1.width/2, column1.y-column1.height/2,null);g.drawImage(column2.image,column2.x-column2.width/2, column2.y-column2.height/2,null);//在paint方法中添加绘制分数的算法Font f = new Font(Font.SANS_SERIF,Font.BOLD,40);g.setFont(f);g.drawString(&&+score, 40, 60);g.setColor(Color.WHITE);g.drawString(&&+score, 40 - 3, 60 - 3);g.drawImage(ground.image, ground.x, ground.y, null);//旋转(rotate)绘图坐标系,是API方法Graphics2D g2 = (Graphics2D)g2.rotate(-bird.alpha, bird.x, bird.y);g.drawImage(bird.image, bird.x - bird.width/2, bird.y - bird.height/2, null);g2.rotate(bird.alpha, bird.x,bird.y);//在paint方法中添加显示游戏结束状态代码switch(state){case GAMEOVER:g.drawImage(gameOverImage, 0, 0, null);case START:g.drawImage(startImage, 0, 0, null);}//添加调试的方框//g.drawRect(bird.x-bird.size/2, bird.y-bird.size/2, bird.size, bird.size);//g.drawRect(column1.x-column1.width/2, column1.y-column1.height/2, column1.width, column1.height/2-column1.gap/2);//g.drawRect(column1.x-column1.width/2, column1.y+column1.gap/2, column1.width, column1.height/2-column1.gap/2);}//paint方法的结束//BirdGame中添加方法action()public void action() throws Exception {MouseListener m = new MouseAdapter(){public void mousePressed(MouseEvent e){ try{switch(state){case GAMEOVER:column1 = new Column(1);column2 = new Column(2);bird = new Bird();score = 0;state = START;case START:state = RUNNING;case RUNNING://鸟向上飞bird.flappy();}}catch(Exception ex){ex.printStackTrace();}}};//将m挂接到当前的面板(game)上addMouseListener(m);while(true){switch(state){case START:bird.fly();ground.step();case RUNNING:column1.step();column2.step();bird.step();//上下移动bird.fly();//挥动翅膀ground.step();//地面移动//计分逻辑if(bird.x == column1.x||bird.x == column2.x){score++;}//如果小鸟撞地面游戏结束if(bird.hit(ground)||bird.hit(column1)||bird.hit(column2)){state = GAMEOVER;}}repaint();Thread.sleep(1000/60);}}//启动软件的方法public static void main(String[] args) throws Exception {// TODO Auto-generated method stubJFrame frame = new JFrame();BirdGame game = new BirdGame();frame.add(game);frame.setSize(440, 670);frame.setLocationRelativeTo(null);frame.setVisible(true);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);game.action();}}结果如下:Exception in thread &main& java.lang.IllegalArgumentException: input == null!at javax.imageio.ImageIO.read(Unknown Source)at com.peng.bird.BirdGame.&init&(BirdGame.java:34)at com.peng.bird.BirdGame.main(BirdGame.java:136)
java多少钱?万和专注it教育24年,优秀的师资团队,雄厚的教学环境,赢得数万学子的好评,万和24年不开分支机构,只为专注教学品质,传承万和不朽品牌!
在线等解答,急急急
非法参数异常
大神,大神
你的hit方法在哪呢。。
大神大神,快帮忙,急啊
登录百度帐号推荐应用吧里的大神快来啊,小白求指教_图拉丁吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:1,748,376贴子:
吧里的大神快来啊,小白求指教收藏
大神快来,大神快来,大神快来,重要的事情说三遍
金万码电子巡更系统,质量精良,售后完善
二楼,哈哈
电脑无缘无故出现这个东东,什么意思啊
图吧欺负新人吗
该怎么解决呢,头大
人呢,都哪里去啦
神牛摄影器材--为专业摄影者打造,你值得拥有!
Scanning BIOS Image in Hard Drive,说明BIOS已经损坏提示的意思是:扫描存储在硬盘上的BIOS镜像。建议刷新BIOS
额12级大神说了,没错了那个是要你刷入BOSS
我是来看你头像的
是不是按了一键刷BIOS的键? 断电抠电池,要不就刷一下子
登录百度帐号推荐应用

我要回帖

更多关于 直排轮滑基础教程 的文章

 

随机推荐