當前位置: 首頁>>代碼示例>>Java>>正文


Java Painter.fill方法代碼示例

本文整理匯總了Java中com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter.fill方法的典型用法代碼示例。如果您正苦於以下問題:Java Painter.fill方法的具體用法?Java Painter.fill怎麽用?Java Painter.fill使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter的用法示例。


在下文中一共展示了Painter.fill方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: build

import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //導入方法依賴的package包/類
@Override
protected boolean build() {

	Arrays.fill( map, Terrain.WALL );
	Painter.fill( this, 1, 1, SIZE, SIZE, Terrain.WATER );
	Painter.fill( this, 2, 2, SIZE-2, SIZE-2, Terrain.EMPTY );
	Painter.fill( this, SIZE/2, SIZE/2, 3, 3, Terrain.EMPTY_SP );
	
	entrance = SIZE * WIDTH + SIZE / 2 + 1;
	map[entrance] = Terrain.ENTRANCE;
	
	exit = entrance - WIDTH * SIZE;
	map[exit] = Terrain.LOCKED_EXIT;
	
	pedestal = (SIZE / 2 + 1) * (WIDTH + 1);
	map[pedestal] = Terrain.PEDESTAL;
	map[pedestal-1] = map[pedestal+1] = Terrain.STATUE_SP;
	
	feeling = Feeling.NONE;
	
	return true;
}
 
開發者ID:wolispace,項目名稱:soft-pixel-dungeon,代碼行數:23,代碼來源:LastLevel.java

示例2: paint

import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //導入方法依賴的package包/類
@Override
public void paint(Level level) {
	Painter.fill( level, this, Terrain.WALL );
	Painter.fill( level, this, 1, Terrain.EMPTY );
	Painter.fill( level, this, 2, Terrain.EMPTY_SP );
	Painter.fill( level, this, 3, Terrain.WATER );
	
	int minDim = Math.min(width(), height());
	int numFish = (minDim - 4)/3; //1-3 fish, depending on room size
	
	for (int i=0; i < numFish; i++) {
		Piranha piranha = new Piranha();
		do {
			piranha.pos = level.pointToCell(random(3));
		} while (level.map[piranha.pos] != Terrain.WATER|| level.findMob( piranha.pos ) != null);
		level.mobs.add( piranha );
	}
	
	for (Door door : connected.values()) {
		door.set( Door.Type.REGULAR );
	}
	
	super.paint(level);
}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon-gdx,代碼行數:25,代碼來源:AquariumRoom.java

示例3: paint

import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //導入方法依賴的package包/類
@Override
public void paint(Level level) {
	Painter.fill(level, this, 1, Terrain.CHASM);

	super.paint(level);

	for (Room r : neigbours){
		if (r instanceof BridgeRoom || r instanceof RingBridgeRoom || r instanceof WalkwayRoom){
			Rect i = intersect(r);
			if (i.width() != 0){
				i.left++;
				i.right--;
			} else {
				i.top++;
				i.bottom--;
			}
			Painter.fill(level, i.left, i.top, i.width()+1, i.height()+1, Terrain.CHASM);
		}
	}
}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon-gdx,代碼行數:21,代碼來源:RingBridgeRoom.java

示例4: paint

import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //導入方法依賴的package包/類
public void paint(Level level ) {
	
	Painter.fill( level, this, Terrain.WALL );
	Painter.fill( level, this, 1, Terrain.EMPTY );
	
	Painter.fill( level, left+1, top+1, width()-2, 1, Terrain.WALL_DECO);
	Painter.fill( level, left+1, top+2, width()-2, 1, Terrain.WATER);
	
	Painter.set( level, left+width()/2, top+1, Terrain.LOCKED_EXIT);
	level.exit = level.pointToCell(new Point(left+width()/2, top+1));
	
	do {
		level.entrance = level.pointToCell(random(3));
	} while (level.findMob(level.entrance) != null);
	Painter.set( level, level.entrance, Terrain.ENTRANCE );
	
	for (Room.Door door : connected.values()) {
		door.set( Room.Door.Type.REGULAR );
		
		if (door.y == top){
			Painter.set( level, door.x, door.y+1, Terrain.WATER);
		}
	}
	
}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon-gdx,代碼行數:26,代碼來源:SewerBossEntranceRoom.java

示例5: paint

import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //導入方法依賴的package包/類
public void paint( Level level ) {

		Painter.fill( level, this, Terrain.WALL );
		Painter.fill( level, this, 1, Terrain.EMPTY_SP );
		Painter.fill( level, this, 2, Terrain.EMPTY );
		
		int cx = (left + right) / 2;
		int cy = (top + bottom) / 2;
		int c = cx + cy * level.width();
		
		Random.shuffle(prizeClasses);
		
		Item i1, i2;
		do {
			i1 = prize( level );
			i2 = prize( level );
		} while (i1.getClass() == i2.getClass());
		level.drop( i1, c ).type = Heap.Type.CRYSTAL_CHEST;
		level.drop( i2, c + PathFinder.NEIGHBOURS8[Random.Int( 8 )]).type = Heap.Type.CRYSTAL_CHEST;
		level.addItemToSpawn( new CrystalKey( Dungeon.depth ) );
		
		entrance().set( Door.Type.LOCKED );
		level.addItemToSpawn( new IronKey( Dungeon.depth ) );
	}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon-gdx,代碼行數:25,代碼來源:VaultRoom.java

示例6: paint

import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //導入方法依賴的package包/類
@Override
public void paint(Level level) {
	Painter.fill( level, this, Terrain.WALL );

	Painter.fillEllipse( level, this, 1 , Terrain.EMPTY );

	for (Door door : connected.values()) {
		door.set( Door.Type.REGULAR );
		if (door.x == left || door.x == right){
			Painter.drawInside(level, this, door, width()/2, Terrain.EMPTY);
		} else {
			Painter.drawInside(level, this, door, height()/2, Terrain.EMPTY);
		}
	}

	Painter.fillEllipse( level, this, 3 , Terrain.CHASM );
}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon,代碼行數:18,代碼來源:CirclePitRoom.java

示例7: paint

import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //導入方法依賴的package包/類
public void paint( Level level ) {
	
	final int floor = Terrain.EMPTY_SP;
	
	Painter.fill( level, this, Terrain.WALL );
	Painter.fill( level, this, 1, floor );

	boolean honeyPot = Random.Int( 2 ) == 0;
	
	int n = Random.IntRange( 3, 4 );
	for (int i=0; i < n; i++) {
		int pos;
		do {
			pos = level.pointToCell(random());
		} while (level.map[pos] != floor);
		if (honeyPot){
			level.drop( new Honeypot(), pos);
			honeyPot = false;
		} else
			level.drop( prize( level ), pos );
	}
	
	entrance().set( Door.Type.BARRICADE );
	level.addItemToSpawn( new PotionOfLiquidFlame() );
}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon-gdx,代碼行數:26,代碼來源:StorageRoom.java

示例8: build

import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //導入方法依賴的package包/類
@Override
protected boolean build() {
	
	Painter.fill( this, LEFT, TOP, HALL_WIDTH, HALL_HEIGHT, Terrain.EMPTY );
	Painter.fill( this, CENTER, TOP, 1, HALL_HEIGHT, Terrain.EMPTY_SP );
	
	int y = TOP + 1;
	while (y < TOP + HALL_HEIGHT) {
		map[y * WIDTH + CENTER - 2] = Terrain.STATUE_SP;
		map[y * WIDTH + CENTER + 2] = Terrain.STATUE_SP;
		y += 2;
	}
	
	int left = pedestal( true );
	int right = pedestal( false );
	map[left] = map[right] = Terrain.PEDESTAL;
	for (int i=left+1; i < right; i++) {
		map[i] = Terrain.EMPTY_SP;
	}
	
	exit = (TOP - 1) * WIDTH + CENTER;
	map[exit] = Terrain.LOCKED_EXIT;
	
	arenaDoor = (TOP + HALL_HEIGHT) * WIDTH + CENTER;
	map[arenaDoor] = Terrain.DOOR;
	
	Painter.fill( this, LEFT, TOP + HALL_HEIGHT + 1, HALL_WIDTH, CHAMBER_HEIGHT, Terrain.EMPTY );
	Painter.fill( this, LEFT, TOP + HALL_HEIGHT + 1, 1, CHAMBER_HEIGHT, Terrain.BOOKSHELF );
	Painter.fill( this, LEFT + HALL_WIDTH - 1, TOP + HALL_HEIGHT + 1, 1, CHAMBER_HEIGHT, Terrain.BOOKSHELF );
	
	entrance = (TOP + HALL_HEIGHT + 2 + Random.Int( CHAMBER_HEIGHT - 1 )) * WIDTH + LEFT + (/*1 +*/ Random.Int( HALL_WIDTH-2 )); 
	map[entrance] = Terrain.ENTRANCE;
	
	return true;
}
 
開發者ID:wolispace,項目名稱:soft-pixel-dungeon,代碼行數:36,代碼來源:CityBossLevel.java

示例9: paint

import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //導入方法依賴的package包/類
@Override
public void paint(Level level) {
	super.paint(level);

	int floor = level.tunnelTile();

	Rect ring = getConnectionSpace();

	Painter.fill( level, ring.left, ring.top, 3, 3,  floor);
	Painter.fill( level, ring.left+1, ring.top+1, 1, 1,  Terrain.WALL);
}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon,代碼行數:12,代碼來源:RingTunnelRoom.java

示例10: paint

import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //導入方法依賴的package包/類
public void paint(Level level ) {

		Painter.fill( level, this, Terrain.WALL );
		Painter.fill( level, this, 1, Terrain.TRAP );
		Painter.fill( level, this, 2, Terrain.EMPTY_SP );
		
		for (int i=0; i < 2; i++) {
			int pos;
			do {
				pos = level.pointToCell(random());
			} while (level.map[pos] != Terrain.EMPTY_SP);
			level.drop(
				Generator.random( Random.oneOf(
					Generator.Category.ARMOR,
					Generator.Category.WEAPON
				) ), pos );
		}
		
		for (Door door : connected.values()) {
			door.set( Door.Type.REGULAR );
			Painter.drawInside( level, this, door, 1, Terrain.EMPTY );
		}
		
		Blacksmith npc = new Blacksmith();
		do {
			npc.pos = level.pointToCell(random( 2 ));
		} while (level.heaps.get( npc.pos ) != null);
		level.mobs.add( npc );

		for(Point p : getPoints()) {
			int cell = level.pointToCell(p);
			if (level.map[cell] == Terrain.TRAP){
				level.setTrap(new BurningTrap().reveal(), cell);
			}
		}
	}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon-gdx,代碼行數:37,代碼來源:BlacksmithRoom.java

示例11: paint

import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //導入方法依賴的package包/類
public void paint( Level level ) {

		Door entrance = entrance();
		entrance.set(Door.Type.LOCKED);
		level.addItemToSpawn(new IronKey(Dungeon.depth));

		Painter.fill(level, this, Terrain.WALL);
		Painter.fill(level, this, 1, Terrain.GRASS);


		int heartX = Random.IntRange(left+1, right-1);
		int heartY = Random.IntRange(top+1, bottom-1);

		if (entrance.x == left) {
			heartX = right - 1;
		} else if (entrance.x == right) {
			heartX = left + 1;
		} else if (entrance.y == top) {
			heartY = bottom - 1;
		} else if (entrance.y == bottom) {
			heartY = top + 1;
		}

		placePlant(level, heartX + heartY * level.width(), new RotHeart());

		int lashers = ((width()-2)*(height()-2))/8;

		for (int i = 1; i <= lashers; i++){
			int pos;
			do {
				pos = level.pointToCell(random());
			} while (!validPlantPos(level, pos));
			placePlant(level, pos, new RotLasher());
		}
	}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon,代碼行數:36,代碼來源:RotGardenRoom.java

示例12: paint

import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //導入方法依賴的package包/類
@Override
public void paint(Level level) {
	Painter.fill( level, this, Terrain.WALL );
	Painter.fill(level, this, 1, Terrain.EMPTY );
	
	Point brokenPotPos = center();
	
	brokenPotPos.x = (brokenPotPos.x + entrance().x) / 2;
	brokenPotPos.y = (brokenPotPos.y + entrance().y) / 2;
	
	Honeypot.ShatteredPot pot = new Honeypot.ShatteredPot();
	level.drop(pot, level.pointToCell(brokenPotPos));
	
	Bee bee = new Bee();
	bee.spawn( Dungeon.depth );
	bee.HP = bee.HT;
	bee.pos = level.pointToCell(brokenPotPos);
	level.mobs.add( bee );
	
	pot.setBee(bee);
	bee.setPotInfo(level.pointToCell(brokenPotPos), null);
	
	placeItem(new Honeypot(), level);
	
	placeItem( Random.Int(3) == 0 ? new Bomb.DoubleBomb() : new Bomb(), level);
	
	if (Random.Int(2) == 0){
		placeItem( new Bomb(), level);
	}
	
	entrance().set(Door.Type.HIDDEN);
}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon,代碼行數:33,代碼來源:SecretHoneypotRoom.java

示例13: paint

import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //導入方法依賴的package包/類
public void paint( Level level ) {
	
	Painter.fill( level, this, Terrain.WALL );
	Painter.fill( level, this, 1, Terrain.EMPTY_SP );
	
	Door entrance = entrance();
	
	Painter.fill( level, left + 1, top+1, width() - 2, 1 , Terrain.BOOKSHELF );
	Painter.drawInside(level, this, entrance, 1, Terrain.EMPTY_SP );
	
	int n = Random.IntRange( 2, 3 );
	for (int i=0; i < n; i++) {
		int pos;
		do {
			pos = level.pointToCell(random());
		} while (level.map[pos] != Terrain.EMPTY_SP || level.heaps.get( pos ) != null);
		Item item;
		if (i == 0)
			item = Random.Int(2) == 0 ? new ScrollOfIdentify() : new ScrollOfRemoveCurse();
		else
			item = prize( level );
		level.drop( item, pos );
	}
	
	entrance.set( Door.Type.LOCKED );
	
	level.addItemToSpawn( new IronKey( Dungeon.depth ) );
}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon,代碼行數:29,代碼來源:LibraryRoom.java

示例14: paint

import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //導入方法依賴的package包/類
public void paint( Level level ) {
	
	Painter.fill( level, this, Terrain.WALL );
	Painter.fill( level, this, 1, Terrain.BOOKSHELF );
	
	Painter.fillEllipse(level, this, 2, Terrain.EMPTY_SP);
	
	Door entrance = entrance();
	if (entrance.x == left || entrance.x == right){
		Painter.drawInside(level, this, entrance, (width() - 3) / 2, Terrain.EMPTY_SP);
	} else {
		Painter.drawInside(level, this, entrance, (height() - 3) / 2, Terrain.EMPTY_SP);
	}
	entrance.set( Door.Type.HIDDEN );
	
	int n = Random.IntRange( 2, 3 );
	HashMap<Class<? extends Scroll>, Float> chances = new HashMap<>(scrollChances);
	for (int i=0; i < n; i++) {
		int pos;
		do {
			pos = level.pointToCell(random());
		} while (level.map[pos] != Terrain.EMPTY_SP || level.heaps.get( pos ) != null);
		
		try{
			Class<?extends Scroll> scrollCls = Random.chances(chances);
			chances.put(scrollCls, 0f);
			level.drop( scrollCls.newInstance(), pos );
		} catch (Exception e){
			ShatteredPixelDungeon.reportException(e);
		}
		
	}
}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon,代碼行數:34,代碼來源:SecretLibraryRoom.java

示例15: paint

import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //導入方法依賴的package包/類
@Override
public void paint( Level level ) {
	Painter.fill( level, this, Terrain.WALL );
	Painter.fill( level, this, 1 , Terrain.EMPTY );
	
	for (Door door : connected.values()) {
		door.set( Door.Type.REGULAR );
		//set door areas to be empty to help with create walls logic
		Painter.set(level, door, Terrain.EMPTY);
	}
	
	createWalls( level, new Rect(left+1, top+1, right-1, bottom-1));
}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon-gdx,代碼行數:14,代碼來源:SegmentedRoom.java


注:本文中的com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter.fill方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。