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

📄 ground.java

📁 一个java写的大富翁游戏
💻 JAVA
字号:
package rich;

import javax.swing.ImageIcon;

public class Ground {
	int cost=0;
	int lvl=0;
	int profit=0;
	int address;
	ImageIcon icon = new ImageIcon(getClass().getResource("picture/lvl0.gif"));
	Character Owner;
	int x,y;
	String groundType;
	
	Ground(int cost,int profit,int address,int x,int y){
		this.cost = cost;
		this.profit = profit;
		this.address = address;
		this.x = x;
		this.y = y;
		Owner = null;
		groundType = "house";
	}
	
	public void levelUp(){
		lvl++;
		switch(lvl){
			case 1:
				icon = new ImageIcon(getClass().getResource("picture/lvl1.gif"));
				break;
			case 2:
				icon = new ImageIcon(getClass().getResource("picture/lvl2.gif"));
				break;
			case 3:
				icon = new ImageIcon(getClass().getResource("picture/lvl3.gif"));
				break;
			case 4:
				icon = new ImageIcon(getClass().getResource("picture/lvl4.gif"));
				break;
			case 5:
				icon = new ImageIcon(getClass().getResource("picture/lvl5.gif"));
				break;
			case 6:
				icon = new ImageIcon(getClass().getResource("picture/lvl6.gif"));
				break;
			case 7:
				icon = new ImageIcon(getClass().getResource("picture/lvl7.gif"));
				break;
			case 8:
				icon = new ImageIcon(getClass().getResource("picture/lvl8.gif"));
				break;

				
		}	


	}
	
	public boolean gotOwner(){ 
		if(Owner == null){
			return false; 
		}
		else{
			return true;
		}
	}
	
	
	public void setIcon(ImageIcon icon){ this.icon = icon;}
	public ImageIcon getIcon(){ return icon; }
	public int getLevel(){ return lvl; }
	public int getAddress(){ return address; }
	public int getCost(){ return cost; }
	public int getProfit(){return profit+(lvl*500); }
	public void setOwner(Character name){ this.Owner = name; }
	public Character getOwner(){ return Owner; }
	public void setX(int x){ this.x = x;}
	public int getX(){ return x;}
	public void setY(int y){ this.y = y; }
	public int getY(){ return y; }
	public int getIconHeight(){	return icon.getIconHeight(); }
	public int getIconWidth(){	return icon.getIconWidth(); }
	public void setGroundType(String groundType){ this.groundType = groundType;}
	public String getGroundType(){ return groundType; }
	
}

⌨️ 快捷键说明

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