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


Java PathFinder.NEIGHBOURS4属性代码示例

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


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

示例1: spawnAround

public static void spawnAround(int pos) {
	for (int n : PathFinder.NEIGHBOURS4) {
		int cell = pos + n;
		if (Level.passable[cell] && Actor.findChar(cell) == null) {
			spawnAt(cell);
		}
	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:8,代码来源:SpectralRat.java

示例2: spawnAroundChance

public static void spawnAroundChance(int pos) {
	for (int n : PathFinder.NEIGHBOURS4) {
		int cell = pos + n;
		if (Level.passable[cell] && Actor.findChar(cell) == null && Random.Float() < 0.75f) {
			spawnAt(cell);
		}
	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:8,代码来源:SpectralRat.java

示例3: spawnAroundChance

public static void spawnAroundChance(int pos) {
	for (int n : PathFinder.NEIGHBOURS4) {
		int cell = pos + n;
		if (Level.passable[cell] && Actor.findChar(cell) == null && Random.Float() < 0.25f) {
			spawnAt(cell);
			GLog.i(Messages.get(Lichen.class, "spawn"));
		}
	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:9,代码来源:Lichen.java

示例4: spawnAroundChance

public static void spawnAroundChance(int pos) {
	for (int n : PathFinder.NEIGHBOURS4) {
		int cell = pos + n;
		if (Level.passable[cell] && Actor.findChar(cell) == null && Random.Float() < 0.50f) {
			spawnAt(cell);
		}
	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:8,代码来源:Eye.java

示例5: spawnAround

public static void spawnAround(int pos) {
	for (int n : PathFinder.NEIGHBOURS4) {
		GLog.n(Messages.get(PoisonGoo.class, "squeeze"));
		int cell = pos + n;
		if (Level.passable[cell] && Actor.findChar(cell) == null) {
			spawnAt(cell);
			GLog.n(Messages.get(PoisonGoo.class, "create"));
		}
	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:10,代码来源:PoisonGoo.java

示例6: flood

private void flood(int distance, Hero hero) {
	charge = 0;
	ArrayList<Integer> affected = new ArrayList<Integer>();

	int length = Dungeon.level.getLength();
	int width = Dungeon.level.getWidth();
	for (int i = width; i < length - width; i++) {
		int dist = Dungeon.level.distance(hero.pos, i);
		if (dist < distance) {
			//GLog.i("TRI2 %s", dist);
			if (checkFloodable(i)) {
				affected.add(i);
				Dungeon.level.map[i] = Terrain.WATER;
				Level.water[i] = true;
			}
		}

	}
	//GLog.i("TRI1 %s", length);
	for (int n : affected) {
		int t = Terrain.WATER_TILES;
		for (int j = 0; j < PathFinder.NEIGHBOURS4.length; j++) {
			if ((Terrain.flags[Dungeon.level.map[n + PathFinder.NEIGHBOURS4[j]]] & Terrain.UNSTITCHABLE) != 0) {
				t += 1 << j;

			}
		}

		Char ch = Actor.findChar(n);
		if (ch != null && ch != hero) {
			Buff.affect(ch, Slow.class, Slow.duration(ch) / 3 + level);
		}

		Dungeon.level.map[n] = t;
		//Level.water[i] = true;
		GameScene.updateMap(n);
	}
	Dungeon.observe();

}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:40,代码来源:NeptunusTrident.java

示例7: spawnAround

public static void spawnAround( int pos ) {
	for (int n : PathFinder.NEIGHBOURS4) {
		int cell = pos + n;
		if (Level.passable[cell] && Actor.findChar( cell ) == null) {
			spawnAt( cell );
		}
	}
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:8,代码来源:Wraith.java

示例8: destroy

public void destroy( int pos ) {

		if (!DungeonTilemap.waterStitcheable.contains(map[pos])) {
			for (int j = 0; j < PathFinder.NEIGHBOURS4.length; j++) {
				if (water[pos + PathFinder.NEIGHBOURS4[j]]) {
					set(pos, Terrain.WATER);
					return;
				}
			}
		}

		set( pos, Terrain.EMBERS );
	}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:13,代码来源:Level.java

示例9: buildFlagMaps

protected void buildFlagMaps() {

		for (int i = 0; i < getLength(); i++) {
			int flags = Terrain.flags[map[i]];
			passable[i] = (flags & Terrain.PASSABLE) != 0;
			losBlocking[i] = (flags & Terrain.LOS_BLOCKING) != 0;
			flamable[i] = (flags & Terrain.FLAMABLE) != 0;
			secret[i] = (flags & Terrain.SECRET) != 0;
			solid[i] = (flags & Terrain.SOLID) != 0;
			avoid[i] = (flags & Terrain.AVOID) != 0;
			water[i] = (flags & Terrain.LIQUID) != 0;
			pit[i] = (flags & Terrain.PIT) != 0;
		}

		int lastRow = getLength() - getWidth();
		for (int i = 0; i < getWidth(); i++) {
			passable[i] = avoid[i] = false;
			passable[lastRow + i] = avoid[lastRow + i] = false;
		}
		for (int i = getWidth(); i < lastRow; i += getWidth()) {
			passable[i] = avoid[i] = false;
			passable[i + getWidth() - 1] = avoid[i + getWidth() - 1] = false;
		}

		for (int i = getWidth(); i < getLength() - getWidth(); i++) {

			if (water[i]) {
				int t = Terrain.WATER_TILES;
				for (int j = 0; j < PathFinder.NEIGHBOURS4.length; j++) {
					if ((Terrain.flags[map[i + PathFinder.NEIGHBOURS4[j]]] & Terrain.UNSTITCHABLE) != 0) {
						t += 1 << j;
					}
				}
				map[i] = t;
			}

			if (pit[i]) {
				if (!pit[i - getWidth()]) {
					int c = map[i - getWidth()];
					if (c == Terrain.EMPTY_SP || c == Terrain.STATUE_SP) {
						map[i] = Terrain.CHASM_FLOOR_SP;
					} else if (water[i - getWidth()]) {
						map[i] = Terrain.CHASM_WATER;
					} else if ((Terrain.flags[c] & Terrain.UNSTITCHABLE) != 0) {
						map[i] = Terrain.CHASM_WALL;
					} else {
						map[i] = Terrain.CHASM_FLOOR;
					}
				}
			}
		}
	}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:52,代码来源:Level.java

示例10: shatter

public Item shatter(Char owner, int pos) {

		if (Dungeon.visible[pos]) {
			Sample.INSTANCE.play(Assets.SND_SHATTER);
			Splash.at(pos, 0xffd500, 5);
		}

		int newPos = pos;
		if (Actor.findChar(pos) != null) {
			ArrayList<Integer> candidates = new ArrayList<Integer>();
			boolean[] passable = Level.passable;

			for (int n : PathFinder.NEIGHBOURS4) {
				int c = pos + n;
				if (passable[c] && Actor.findChar(c) == null) {
					candidates.add(c);
				}
			}

			newPos = candidates.size() > 0 ? Random.element(candidates) : -1;
		}

		if (newPos != -1 && !Dungeon.hero.haspet) {
			bee bee = new bee();
			bee.spawn(1);
			bee.HP = bee.HT;
			bee.pos = newPos;
			bee.state = bee.HUNTING;

			GameScene.add(bee);
			Actor.addDelayed(new Pushing(bee, pos, newPos), -1f);

			bee.sprite.alpha(0);
			bee.sprite.parent.add(new AlphaTweener(bee.sprite, 1, 0.15f));

			Sample.INSTANCE.play(Assets.SND_BEE);
			Dungeon.hero.haspet = true;
			GLog.p(Messages.get(SteelHoneypot.class, "str"));

			return new PotionOfStrength();

		} else {
			return this;
		}
	}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:45,代码来源:SteelHoneypot.java

示例11: shatter

public Item shatter(Char owner, int pos) {

		if (Dungeon.visible[pos]) {
			Sample.INSTANCE.play(Assets.SND_SHATTER);
			Splash.at(pos, 0xffd500, 5);
		}

		int newPos = pos;
		if (Actor.findChar(pos) != null) {
			ArrayList<Integer> candidates = new ArrayList<Integer>();
			boolean[] passable = Level.passable;

			for (int n : PathFinder.NEIGHBOURS4) {
				int c = pos + n;
				if (passable[c] && Actor.findChar(c) == null) {
					candidates.add(c);
				}
			}

			newPos = candidates.size() > 0 ? Random.element(candidates) : -1;
		}

		if (newPos != -1) {
			Bee bee = new Bee();
			bee.spawn(Dungeon.depth);
			bee.setPotInfo(pos, owner);
			bee.HP = bee.HT;
			bee.pos = newPos;

			GameScene.add(bee);
			Actor.addDelayed(new Pushing(bee, pos, newPos), -1f);

			bee.sprite.alpha(0);
			bee.sprite.parent.add(new AlphaTweener(bee.sprite, 1, 0.15f));

			Sample.INSTANCE.play(Assets.SND_BEE);
			return new ShatteredPot().setBee(bee);
		} else {
			return this;
		}
	}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:41,代码来源:Honeypot.java

示例12: shatter

public Item shatter( Char owner, int pos ) {
	
	if (Dungeon.visible[pos]) {
		Sample.INSTANCE.play( Assets.SND_SHATTER );
		Splash.at( pos, 0xffd500, 5 );
	}
	
	int newPos = pos;
	if (Actor.findChar( pos ) != null) {
		ArrayList<Integer> candidates = new ArrayList<Integer>();
		boolean[] passable = Level.passable;
		
		for (int n : PathFinder.NEIGHBOURS4) {
			int c = pos + n;
			if (passable[c] && Actor.findChar( c ) == null) {
				candidates.add( c );
			}
		}

		newPos = candidates.size() > 0 ? Random.element( candidates ) : -1;
	}
	
	if (newPos != -1) {
		Bee bee = new Bee();
		bee.spawn( Dungeon.depth );
		bee.setPotInfo( pos, owner );
		bee.HP = bee.HT;
		bee.pos = newPos;
		
		GameScene.add( bee );
		Actor.addDelayed( new Pushing( bee, pos, newPos ), -1f );
		
		bee.sprite.alpha( 0 );
		bee.sprite.parent.add( new AlphaTweener( bee.sprite, 1, 0.15f ) );
		
		Sample.INSTANCE.play( Assets.SND_BEE );
		return new ShatteredPot().setBee( bee );
	} else {
		return this;
	}
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:41,代码来源:Honeypot.java


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