⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 .#merg15416cvs

📁 java编写的打鸟游戏
💻 #MERG15416CVS
字号:
/* * Bird.java * * Created on 2007年12月19日, 上午11:41 * * To change this template, choose Tools | Template Manager * and open the template in the editor. */package graphics;import SBGameCore.*;import java.util.Random;import java.awt.Graphics;/** * * @author wusir */public class Bird extends Comp{    int[] randoms = new int[]{25,0,50};    int[] randomv = new int[]{100,200};    /**     * Creates a new instance of Bird     */    public Bird(GraphicsPanel a) {        this.a = a;        w =154;        h = 153;     //   w = (int) Math.random()*100;     //   h = (int) Math.random()*100;                Random rndv = new Random();          int x = 0;        x = rndv.nextInt(2);        px = opx =  randomv[x];        py = opy =  randomv[x];        active = true;        img = a.birds[2];        //k = (k+1)%7;     /*   Random rndv = new Random();          int x = 0;        x = rndv.nextInt(3);         vx = randomv[x];        try {Thread.sleep(100);} catch(Exception e) {};         int y = rndv.nextInt(3);         vy = randomv[y];*/    }    public void move() {        opx = px;        opy = py;             Random rnd = new Random();        int x = 0;        x = rnd.nextInt(3);         px = randoms[x] + px;        try {Thread.sleep(100);} catch(Exception e) {};        int y = rnd.nextInt(3);         py = randoms[y] + py;            }       /* public boolean has_moved(){        if((px - opx) != 0)return true;        return false;    }*/        public void draw(){        set_draw_rectangles(a.paint_area,a.new_area);        Graphics bg = a.buffer.getGraphics();        bg.clipRect(a.paint_area.x,a.paint_area.y,w,h);        bg.drawImage(a.backdrop,0,0,a);        bg.dispose();                bg = a.buffer.getGraphics();        bg.clipRect(a.new_area.x,a.new_area.y,w,h);        bg.drawImage(img,a.new_area.x,a.new_area.y,a);        bg.dispose();                a.paint_area.add(a.new_area);                Graphics g = a.getGraphics();        g.clipRect(a.paint_area.x,a.paint_area.y,a.paint_area.width,a.paint_area.height);        g.drawImage(a.buffer,0,0,a);        g.dispose();    }  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -