📄 .#merg12253cvs
字号:
/* * 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[]{-1,1}; /** * Creates a new instance of Bird */ public Bird(GraphicsPanel a) { this.a = a; w = (int) Math.random()*100; h = (int) Math.random()*100; px = opx = a.window_size.width/2; py = opy = w/2+1; active = true; img = a.birds[0]; } public void move() { opx = px; opy = py; Random rnd = new Random(); int x = 0; x = rnd.nextInt(2); int dx = randoms[x] + px; try {Thread.sleep(100);} catch(Exception e) {}; int y = rnd.nextInt(2); int dy = 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 + -