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


Java PathFinder.NEIGHBOURS8属性代码示例

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


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

示例1: onThrow

@Override
protected void onThrow(int cell) {
	if (!Level.pit[cell] && lightingFuse) {
		Actor.addDelayed(fuse = new Fuse().ignite(this), 2);
	}
	if (Actor.findChar(cell) != null
			&& !(Actor.findChar(cell) instanceof Hero)) {
		ArrayList<Integer> candidates = new ArrayList<>();
		for (int i : PathFinder.NEIGHBOURS8)
			if (Level.passable[cell + i])
				candidates.add(cell + i);
		int newCell = candidates.isEmpty() ? cell : Random
				.element(candidates);
		Dungeon.level.drop(this, newCell).sprite.drop(cell);
	} else
		super.onThrow(cell);
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:17,代码来源:SmartBomb.java

示例2: activate

@Override
public void activate() {

	int nDrops = Random.NormalIntRange(2, 8);

	ArrayList<Integer> candidates = new ArrayList<Integer>();
	for (int i : PathFinder.NEIGHBOURS8){
		if (Level.passable[pos+i]){
			candidates.add(pos+i);
		}
	}

	for (int i = 0; i < nDrops && !candidates.isEmpty(); i++){
		Integer c = Random.element(candidates);
		Dungeon.level.drop(new Dewdrop(), c).sprite.drop(pos);
		candidates.remove(c);
	}

}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:19,代码来源:WandOfRegrowth.java

示例3: onThrow

@Override
protected void onThrow(int cell) {

	if (Actor.findChar(cell) != null) {
		ArrayList<Integer> candidates = new ArrayList<>();
		for (int i : PathFinder.NEIGHBOURS8)
			if (Level.passable[cell + i])
				candidates.add(cell + i);
		int newCell = candidates.isEmpty() ? cell : Random.element(candidates);

		if (!Level.pit[newCell] && activate) {
			OrbOfZotMob.spawnAt(newCell);
		} else {
			Dungeon.level.drop(this, newCell).sprite.drop(cell);
		}

	} else if (!Level.pit[cell] && activate) {
		OrbOfZotMob.spawnAt(cell);
	} else {

		super.onThrow(cell);
	}

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

示例4: onThrow

@Override
protected void onThrow(int cell) {
	if (Actor.findChar(cell) != null) {
		ArrayList<Integer> candidates = new ArrayList<>();
		for (int i : PathFinder.NEIGHBOURS8)
			if (Level.passable[cell + i])
				candidates.add(cell + i);
		int newCell = candidates.isEmpty() ? cell : Random
				.element(candidates);

		if (!Level.pit[newCell] && seek) {
			SeekingClusterBombNPC.spawnAt(newCell);
		} else {
			Dungeon.level.drop(this, newCell).sprite.drop(cell);
		}

	} else if (!Level.pit[cell] && seek) {
		SeekingClusterBombNPC.spawnAt(cell);

	} else {

		super.onThrow(cell);
	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:24,代码来源:SeekingClusterBombItem.java

示例5: onThrow

@Override
protected void onThrow(int cell) {
	if (!Level.pit[cell] && lightingFuse) {
		Actor.addDelayed(fuse = new Fuse().ignite(this), 2);
	}
	if (Actor.findChar(cell) != null
			&& !(Actor.findChar(cell) instanceof Hero)) {
		ArrayList<Integer> candidates = new ArrayList<>();
		for (int i : PathFinder.NEIGHBOURS8)
			if (Level.passable[cell + i])
				candidates.add(cell + i);
		int newCell = candidates.isEmpty() ? cell : Random
				.element(candidates);
		Dungeon.level.drop(this, newCell).sprite.drop(cell);

	} else
		super.onThrow(cell);
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:18,代码来源:ClusterBomb.java

示例6: getSpawnPos

public int getSpawnPos() {
	int newPos;
	int pos = Dungeon.hero.pos;
	ArrayList<Integer> candidates = new ArrayList<Integer>();
	boolean[] passable = Level.passable;

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

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

	return newPos;
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:17,代码来源:ShadowDragonEgg.java

示例7: move

public void move(int step) {

		if (Dungeon.level.adjacent(step, pos) && buff(Vertigo.class) != null) {
			sprite.interruptMotion();
			int newPos = pos + PathFinder.NEIGHBOURS8[Random.Int(8)];
			if (!(Level.passable[newPos] || Level.avoid[newPos]) || Actor.findChar(newPos) != null)
				return;
			else {
				sprite.move(pos, newPos);
				step = newPos;
			}
		}

		if (Dungeon.level.map[pos] == Terrain.OPEN_DOOR) {
			Door.leave(pos);
		}

		pos = step;

		if (flying && Dungeon.level.map[pos] == Terrain.DOOR) {
			Door.enter(pos);
		}

		if (this != Dungeon.hero) {
			sprite.visible = Dungeon.visible[pos];
		}
	}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:27,代码来源:Char.java

示例8: checkpetNear

private boolean checkpetNear() {
	for (int n : PathFinder.NEIGHBOURS8) {
		int c = pos + n;
		if (Actor.findChar(c) instanceof PET) {
			return true;
		}
	}
	return false;
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:9,代码来源:Hero.java

示例9: randomRespawnCell

@Override
public int randomRespawnCell() {
	int cell = entrance + PathFinder.NEIGHBOURS8[Random.Int(8)];
	while (!passable[cell]){
		cell = entrance + PathFinder.NEIGHBOURS8[Random.Int(8)];
	}
	return cell;
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:8,代码来源:LastLevel.java

示例10: checkpetNear

private boolean checkpetNear() {
	Hero hero = Dungeon.hero;
	for (int n : PathFinder.NEIGHBOURS8) {
		int c = hero.pos + n;
		if (Actor.findChar(c) instanceof PET) {
			return true;
		}
	}
	return false;
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:10,代码来源:Towel.java

示例11: placePlant

private static void placePlant(Level level, int pos, Mob plant){
	plant.pos = pos;
	level.mobs.add( plant );

	for(int i : PathFinder.NEIGHBOURS8) {
		if (level.map[pos + i] == Terrain.GRASS){
			set(level, pos + i, Terrain.HIGH_GRASS);
		}
	}
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:10,代码来源:RotGardenPainter.java

示例12: spawnFists

public void spawnFists() {
	RottingFist fist1 = new RottingFist();
	BurningFist fist2 = new BurningFist();
	
	do {
		fist1.pos = pos + PathFinder.NEIGHBOURS8[Random.Int( 8 )];
		fist2.pos = pos + PathFinder.NEIGHBOURS8[Random.Int( 8 )];
	} while (!Level.passable[fist1.pos] || !Level.passable[fist2.pos] || fist1.pos == fist2.pos);
	
	GameScene.add( fist1 );
	GameScene.add( fist2 );

	notice();
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:14,代码来源:Yog.java

示例13: checkpetNear

private boolean checkpetNear() {
	for (int n : PathFinder.NEIGHBOURS8) {
		int c = Dungeon.hero.pos + n;
		if (Actor.findChar(c) instanceof PET) {
			return true;
		}
	}
	return false;
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:9,代码来源:WndHero.java

示例14: throwItem

protected void throwItem() {
	Heap heap = Dungeon.level.heaps.get( pos );
	if (heap != null) {
		int n;
		do {
			n = pos + PathFinder.NEIGHBOURS8[Random.Int( 8 )];
		} while (!Level.passable[n] && !Level.avoid[n]);
		Dungeon.level.drop( heap.pickUp(), n ).sprite.drop( pos );
	}
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:10,代码来源:NPC.java

示例15: blink

private void blink( int target ) {
	
	Ballistica route = new Ballistica( pos, target, Ballistica.PROJECTILE);
	int cell = route.collisionPos;

	//can't occupy the same cell as another char, so move back one.
	if (Actor.findChar( cell ) != null && cell != this.pos)
		cell = route.path.get(route.dist-1);

	if (Level.avoid[ cell ]){
		ArrayList<Integer> candidates = new ArrayList<>();
		for (int n : PathFinder.NEIGHBOURS8) {
			cell = route.collisionPos + n;
			if (Level.passable[cell] && Actor.findChar( cell ) == null) {
				candidates.add( cell );
			}
		}
		if (candidates.size() > 0)
			cell = Random.element(candidates);
		else {
			delay = BLINK_DELAY;
			return;
		}
	}
	
	ScrollOfTeleportation.appear( this, cell );
	
	delay = BLINK_DELAY;
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:29,代码来源:Succubus.java


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