import java.awt.Color; import java.awt.Graphics; import java.awt.Rectangle; import java.util.Random; /** * ´ú±íµ° * @author Administrator * @download http://www.codefans.net */ public class Egg { int row, col; int w = Yard.BLOCK_SIZE; int h = Yard.BLOCK_SIZE; private static Random r = new Random(); private Color color = Color.GREEN; public Egg(int row, int col) { this.row = row; this.col = col; } public Egg() { this(r.nextInt(Yard.ROWS-2) + 2, r.nextInt(Yard.COLS)); } public void reAppear() { this.row = r.nextInt(Yard.ROWS-2) + 2; this.col = r.nextInt(Yard.COLS); } public Rectangle getRect() { return new Rectangle(Yard.BLOCK_SIZE * col, Yard.BLOCK_SIZE * row, w, h); } public void draw(Graphics g) { Color c = g.getColor(); g.setColor(color); g.fillOval(Yard.BLOCK_SIZE * col, Yard.BLOCK_SIZE * row, w, h); g.setColor(c); if(color == Color.GREEN) color = Color.RED; else color = Color.GREEN; } public int getCol() { return col; } public void setCol(int col) { this.col = col; } public int getRow() { return row; } public void setRow(int row) { this.row = row; } }

微信网友_7556302635110400 LV1
6月16日
鲁一宇 LV5
2024年12月24日
mechanic LV1
2024年4月11日
雨梦岚 LV1
2024年3月3日
Hao Pan LV1
2024年1月5日
心比扎软 LV1
2023年12月21日
ClydeSon LV5
2023年12月18日
微信网友_6770780673069056 LV2
2023年12月9日
steven101 LV1
2023年8月4日
zwj2750514489 LV1
2023年6月29日

微信网友_7556302635110400 LV1
6月16日
鲁一宇 LV5
2024年12月24日
xiao peppa
2024年11月10日
暂无贡献等级
1661950467 LV2
2024年10月12日
3456788 LV1
2024年7月4日
188073301 LV1
2024年6月15日
qweasd669785
2024年6月14日
暂无贡献等级
liqizuiai
2024年5月20日
暂无贡献等级
微信网友_6979151039729664 LV2
2024年5月5日
Dominick LV14
2024年4月29日