当前位置: 首页 > news >正文

网站页面一般做多大做属于公司的网站有什么好处

网站页面一般做多大,做属于公司的网站有什么好处,wordpress出错,建立网站怎么搞游戏玩法#xff1a;通过鼠标点击使小鸟上下移动穿过柱子并完成得分#xff0c;小鸟碰到柱子或掉落到地面上都会结束游戏。 游戏内图片 Brid类#xff1a; package bird;import org.omg.CORBA.IMP_LIMIT;import javax.imageio.ImageIO; import java.awt.image.BufferedIma…游戏玩法通过鼠标点击使小鸟上下移动穿过柱子并完成得分小鸟碰到柱子或掉落到地面上都会结束游戏。 游戏内图片 Brid类 package bird;import org.omg.CORBA.IMP_LIMIT;import javax.imageio.ImageIO; import java.awt.image.BufferedImage;public class Brid {int x,y;int width,height;int size;//鸟的大小用于检测碰撞BufferedImage image; BufferedImage[] images; int index;double g; //重力加速度double t; //两次位置的时间间隔double v0; //初始上抛的速度double speed; //当前上抛的速度double s; //经过时间t以后的位移double alpha; //鸟的倾角单位是弧度public Brid() throws Exception {image ImageIO.read(getClass().getResource(0.png));width image.getWidth();height image.getHeight();x 132;y 280;size 40;g 4;v0 20;t 0.25;speed v0;s 0;alpha 0;images new BufferedImage[8];for (int i 0; i 8; i) {images[i] ImageIO.read(getClass().getResource(i .png));} index0;} public void fly(){index;imageimages[(index/12)%8]; }public void step(){ double v0speed; sv0*tg*t*t/2; //计算上抛运动的位移; yy-(int)s;//计算鸟的位置坐标 double v v0-g*t;//计算下次的速度 speedv; alphaMath.atan(s/8);} public void flappy(){speedv0; //重新设置初始速度重新向上飞 }public boolean hit( Ground ground){boolean hitysize/2ground.y;if(hit){y ground.y-size/2;alpha-3.1415926/2;}return hit;}public boolean hit(Column column) {if (x column.x - column.width / 2 - size / 2 x column.x column.width / 2 size / 2) {if (y column.y - column.gap / 2 size / 2 y column.y column.gap / 2 - size / 2) {return false;}return true;}return false;} } BridGame类 package bird;import javax.imageio.ImageIO; import javax.swing.*; import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.image.BufferedImage;public class BridGame extends JPanel {Brid brid;Column column1,column2;Ground ground;BufferedImage background;int score;// boolean gameOver;//游戏状态int state;public static final int START0;public static final int RUNNING1;public static final int GAME_OVER2;BufferedImage gameOverImage; BufferedImage startImage;public BridGame() throws Exception{//gameOverfalse;stateSTART;gameOverImage ImageIO.read(getClass().getResource(gameover.png));startImageImageIO.read(getClass().getResource(start.png));bridnew Brid();column1new Column(1);column2new Column(2);groundnew Ground();background ImageIO.read(getClass().getResource(bg.png));score0; }Overridepublic void paint(Graphics g) {super.paint(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);g.drawImage(ground.image,ground.x,ground.y,null);Graphics2D g2(Graphics2D) g;g2.rotate(-brid.alpha,brid.x,brid.y);g.drawImage(brid.image,brid.x-brid.width/2,brid.y-brid.width/2,null);g2.rotate(brid.alpha,brid.x,brid.y);Font fnew 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);switch (state){case GAME_OVER:g.drawImage(gameOverImage,0,0,null);break;case START:g.drawImage(startImage,0,0,null);break;}}public void action() throws Exception{ //让地面动起来MouseListener lnew MouseAdapter(){Overridepublic void mousePressed(MouseEvent e) { //鼠标按下// brid.flappy(); //鸟向上飞try {switch (state) {case GAME_OVER:column1 new Column(1);column2 new Column(2);brid new Brid();score 0;state START;break;case START:state RUNNING;case RUNNING:brid.flappy();}}catch (Exception e2){}}};addMouseListener(l);while(true){switch (state){case START:brid.fly();ground.step();break;case RUNNING:ground.step();column1.step();column2.step();brid.step();brid.fly();if(brid.xcolumn1.x||brid.xcolumn2.x){score;}if(brid.hit(ground)||brid.hit(column1)||brid.hit(column2)){stateGAME_OVER;}break;}repaint();Thread.sleep(1000/30);} }public static void main(String[] args) throws Exception {JFrame framenew JFrame();BridGame gamenew BridGame();frame.add(game);frame.setSize(440,670);frame.setLocationRelativeTo(null);frame.setVisible(true);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);game.action();} } Column类 package bird;import javax.imageio.ImageIO; import java.awt.*; import java.awt.font.LineMetrics; import java.awt.image.BufferedImage; import java.util.Random;//柱子 public class Column {int x,y;int width,height;int gap;int distance;BufferedImage image;Random randomnew Random();public Column(int n) throws Exception{image ImageIO.read(getClass().getResource(column.png));widthimage.getWidth();height image.getHeight();gap144;distance245;x550(n-1)*distance;yrandom.nextInt(218)132;} public void step(){x--;if(x-width/2){xdistance*2-width/2;yrandom.nextInt(218)132;} } } Ground类 package bird;import javax.imageio.ImageIO; import java.awt.image.BufferedImage;public class Ground {int x,y;int width,height;BufferedImage image;public Ground() throws Exception{image ImageIO.read(getClass().getResource(ground.png));widthimage.getWidth();height image.getHeight();x0;y500;}//添加方法让地面移动public void step(){x--;if(x-109){x0;}}}
http://www.zqtcl.cn/news/759636/

相关文章:

  • 诸城手机网站建设做竞价网站
  • 网站策划报告公司简介模板范文高大上
  • 做信息图的免费网站如何获取网站是哪个公司制作
  • 乐清建设网站哪家好seo一个月赚多少钱
  • 哈尔滨专业官网建站企业h5公众号开发
  • 商城网站建设精英wordpress实例配置
  • 国内网站开发语言模板兔自用主题WordPress
  • 天津营销网站建设公司哪家好市场营销平台
  • 上海企业响应式网站建设推荐网站建设类织梦模板
  • 洛阳最好的做网站的公司哪家好信誉好的邢台做网站
  • 织梦 旅游网站模板seo百家外链网站
  • 做网站提升公司形象摄影网站建设任务书
  • wordpress建站不好用wordpress共用用户多站点
  • 企业网站设计请示杭州做企业网站的公司
  • 苏宁易购网站建设的不足之处wordpress myisam
  • 互联网站建设维护是做什么的网站建设模板成功案例
  • 制作网站需要什么语言wordpress 免签约支付宝
  • 西安网站开发的未来发展易企网络网站建设
  • 贵州做网站怎么推广vs2012 做网站教程
  • 完全菜鸟七天学会建网站网络营销的四大基础理论
  • 东莞网站优化案例网站职业技术培训学校
  • 银川网站建设公司电话公司在百度做网站找谁
  • 交换链接适用于哪些网站网络规划与设计的目的
  • 网站做标签寺院网站模板
  • 高端h5网站柳州建站
  • 百度商桥网站郑州有做网站的公司没
  • 做专业网站济南品牌网站建设低价
  • 网站制作客户寻找数据中台厂商
  • 免费找图片素材的网站西安企业seo
  • 网站建设 名词解释国内网站建设建设