当前位置: 首页>>代码示例>>Java>>正文


Java Level.addItemToSpawn方法代码示例

本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.levels.Level.addItemToSpawn方法的典型用法代码示例。如果您正苦于以下问题:Java Level.addItemToSpawn方法的具体用法?Java Level.addItemToSpawn怎么用?Java Level.addItemToSpawn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.shatteredpixel.shatteredpixeldungeon.levels.Level的用法示例。


在下文中一共展示了Level.addItemToSpawn方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: paint

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
public static void paint( Level level, Room room ) {
	
	final int floor = Terrain.EMPTY_SP;
	
	fill( level, room, Terrain.WALL );
	fill( level, room, 1, floor );
	
	int n = Random.IntRange( 3, 4 );
	for (int i=0; i < n; i++) {
		int pos;
		do {
			pos = room.random();
		} while (level.map[pos] != floor);
		level.drop( prize( level ), pos );
	}
	
	room.entrance().set( Room.Door.Type.BARRICADE );
	level.addItemToSpawn( new PotionOfLiquidFlame() );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:20,代码来源:StoragePainter.java

示例2: paint

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
public static void paint( Level level, Room room ) {

		fill( level, room, Terrain.WALL );
		fill( level, room, 1, Terrain.EMPTY );

		Point c = room.center();
		int cx = c.x;
		int cy = c.y;
		
		Room.Door entrance = room.entrance();
		
		entrance.set( Room.Door.Type.LOCKED );
		level.addItemToSpawn( new IronKey( Dungeon.depth ) );
		
		if (entrance.x == room.left) {
			set( level, new Point( room.right-1, room.top+1 ), Terrain.STATUE );
			set( level, new Point( room.right-1, room.bottom-1 ), Terrain.STATUE );
			cx = room.right - 2;
		} else if (entrance.x == room.right) {
			set( level, new Point( room.left+1, room.top+1 ), Terrain.STATUE );
			set( level, new Point( room.left+1, room.bottom-1 ), Terrain.STATUE );
			cx = room.left + 2;
		} else if (entrance.y == room.top) {
			set( level, new Point( room.left+1, room.bottom-1 ), Terrain.STATUE );
			set( level, new Point( room.right-1, room.bottom-1 ), Terrain.STATUE );
			cy = room.bottom - 2;
		} else if (entrance.y == room.bottom) {
			set( level, new Point( room.left+1, room.top+1 ), Terrain.STATUE );
			set( level, new Point( room.right-1, room.top+1 ), Terrain.STATUE );
			cy = room.top + 2;
		}
		
		level.drop( prize( level ), cx + cy * Level.WIDTH ).type = Type.TOMB;
	}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:35,代码来源:CryptPainter.java

示例3: paint

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
public static void paint( Level level, Room room ) {

		fill( level, room, Terrain.WALL );
		fill( level, room, 1, Terrain.EMPTY );
		
		int cx = (room.left + room.right) / 2;
		int cy = (room.top + room.bottom) / 2;
		int c = cx + cy * Level.WIDTH;
		
		switch (Random.Int( 3 )) {
		
		case 0:
			level.drop( prize( level ), c ).type = Type.LOCKED_CHEST;
			level.addItemToSpawn( new GoldenKey( Dungeon.depth ) );
			break;
			
		case 1:
			Item i1, i2;
			do {
				i1 = prize( level );
				i2 = prize( level );
			} while (i1.getClass() == i2.getClass());
			level.drop( i1, c ).type = Type.CRYSTAL_CHEST;
			level.drop( i2, c + Level.NEIGHBOURS8[Random.Int( 8 )]).type = Type.CRYSTAL_CHEST;
			level.addItemToSpawn( new GoldenKey( Dungeon.depth ) );
			break;
			
		case 2:
			level.drop( prize( level ), c );
			set( level, c, Terrain.PEDESTAL );
			break;
		}
		
		room.entrance().set( Room.Door.Type.LOCKED );
		level.addItemToSpawn( new IronKey( Dungeon.depth ) );
	}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:37,代码来源:VaultPainter.java

示例4: paint

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
public static void paint( Level level, Room room ) {
	 
	Integer traps[] = {
		Terrain.TOXIC_TRAP, Terrain.TOXIC_TRAP, Terrain.TOXIC_TRAP, 
		Terrain.PARALYTIC_TRAP, Terrain.PARALYTIC_TRAP, 
		!Dungeon.bossLevel( Dungeon.depth + 1 ) ? Terrain.CHASM : Terrain.SUMMONING_TRAP };
	fill( level, room, Terrain.WALL );
	fill( level, room, 1, Random.element( traps ) );
	
	Room.Door door = room.entrance(); 
	door.set( Room.Door.Type.REGULAR );
	
	int lastRow = level.map[room.left + 1 + (room.top + 1) * Level.WIDTH] == Terrain.CHASM ? Terrain.CHASM : Terrain.EMPTY;

	int x = -1;
	int y = -1;
	if (door.x == room.left) {
		x = room.right - 1;
		y = room.top + room.height() / 2;
		fill( level, x, room.top + 1, 1, room.height() - 1 , lastRow );
	} else if (door.x == room.right) {
		x = room.left + 1;
		y = room.top + room.height() / 2;
		fill( level, x, room.top + 1, 1, room.height() - 1 , lastRow );
	} else if (door.y == room.top) {
		x = room.left + room.width() / 2;
		y = room.bottom - 1;
		fill( level, room.left + 1, y, room.width() - 1, 1 , lastRow );
	} else if (door.y == room.bottom) {
		x = room.left + room.width() / 2;
		y = room.top + 1;
		fill( level, room.left + 1, y, room.width() - 1, 1 , lastRow );
	}
	
	int pos = x + y * Level.WIDTH;
	if (Random.Int( 3 ) == 0) {
		if (lastRow == Terrain.CHASM) {
			set( level, pos, Terrain.EMPTY );
		}
		level.drop( prize( level ), pos ).type = Heap.Type.CHEST;
	} else {
		set( level, pos, Terrain.PEDESTAL );
		level.drop( prize( level ), pos );
	}
	
	level.addItemToSpawn( new PotionOfLevitation() );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:48,代码来源:TrapsPainter.java

示例5: paint

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
public static void paint( Level level, Room room ) {
	
	fill( level, room, Terrain.WALL );
	fill( level, room, 1, Terrain.WATER );
	
	Room.Door door = room.entrance(); 
	door.set( Room.Door.Type.REGULAR );

	int x = -1;
	int y = -1;
	if (door.x == room.left) {
		
		x = room.right - 1;
		y = room.top + room.height() / 2;
		
	} else if (door.x == room.right) {
		
		x = room.left + 1;
		y = room.top + room.height() / 2;
		
	} else if (door.y == room.top) {
		
		x = room.left + room.width() / 2;
		y = room.bottom - 1;
		
	} else if (door.y == room.bottom) {
		
		x = room.left + room.width() / 2;
		y = room.top + 1;
		
	}
	
	int pos = x + y * Level.WIDTH;
	level.drop( prize( level ), pos ).type = 
		Random.Int( 3 ) == 0 ? Heap.Type.CHEST : Heap.Type.HEAP;
	set( level, pos, Terrain.PEDESTAL );
	
	level.addItemToSpawn( new PotionOfInvisibility() );
	
	for (int i=0; i < NPIRANHAS; i++) {
		Piranha piranha = new Piranha();
		do {
			piranha.pos = room.random();
		} while (level.map[piranha.pos] != Terrain.WATER|| Actor.findChar( piranha.pos ) != null);
		level.mobs.add( piranha );
		Actor.occupyCell( piranha );
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:49,代码来源:PoolPainter.java

示例6: paint

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
public static void paint( Level level, Room room ) {

		fill( level, room, Terrain.WALL );
		fill( level, room, 1, Terrain.EMPTY );

		Point c = room.center();
		int cx = c.x;
		int cy = c.y;
		
		Room.Door door = room.entrance();
		
		door.set( Room.Door.Type.LOCKED );
		level.addItemToSpawn( new IronKey( Dungeon.depth ) );
		
		if (door.x == room.left) {
			
			fill( level, room.right - 1, room.top + 1, 1, room.height() - 1 , Terrain.STATUE );
			cx = room.right - 2;
			
		} else if (door.x == room.right) {
			
			fill( level, room.left + 1, room.top + 1, 1, room.height() - 1 , Terrain.STATUE );
			cx = room.left + 2;
			
		} else if (door.y == room.top) {
			
			fill( level, room.left + 1, room.bottom - 1, room.width() - 1, 1 , Terrain.STATUE );
			cy = room.bottom - 2;
			
		} else if (door.y == room.bottom) {
			
			fill( level, room.left + 1, room.top + 1, room.width() - 1, 1 , Terrain.STATUE );
			cy = room.top + 2;
			
		}
		
		Statue statue = new Statue();
		statue.pos = cx + cy * Level.WIDTH;
		level.mobs.add( statue );
		Actor.occupyCell( statue );
	}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:42,代码来源:StatuePainter.java


注:本文中的com.shatteredpixel.shatteredpixeldungeon.levels.Level.addItemToSpawn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。