目录

第二周Greenfoot游戏开发螃蟹吃沙蠕虫

目录

第二周:Greenfoot游戏开发(螃蟹吃沙蠕虫)

先安装Greenfoot。

public class World{
	//成员变量
	private int width = 450;
	private int height = 450;

    private Crab[] crab = new Crab[300];

    //构造器
    World(){}

    World(int width, int height){
    	this.width = width;
    	this.height = height;
    }

    //成员方法
    public void setWidth(int width){
    	this.width = width;
    }

    public int getWidth(){
    	return this.width;
    }

    public void setHeight(int height){
    	this.height = height;
    }

    public int getHeight(){
    	return this.height;
    }

}