Java Code Examples for com.watabou.noosa.particles.Emitter#revive()

The following examples show how to use com.watabou.noosa.particles.Emitter#revive() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GameScene.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public static Emitter floorEmitter() {
	if (scene != null) {
		Emitter emitter = (Emitter)scene.floorEmitters.recycle( Emitter.class );
		emitter.revive();
		return emitter;
	} else {
		return null;
	}
}
 
Example 2
Source File: StatusPane.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
	public void update() {
		super.update();
		
		if (
            tagDanger != danger.visible ||
            tagAttack != attack.visible ||
            tagPickup != pickup.visible ||
            tagResume != resume.visible
        ) {

            tagDanger = danger.visible;
            tagAttack = attack.visible;
            tagPickup = pickup.visible;
            tagResume = resume.visible;
			
			layoutTags( bottom );
		}
		
		float health_percent = (float)Dungeon.hero.HP / Dungeon.hero.HT;
		
		if (health_percent == 0) {
			avatar.tint( 0x000000, 0.6f );
//			blood.on = false;
//		} else if (health_percent < 0.25f) {
//			avatar.tint( 0xcc0000, 0.4f );
//			blood.on = true;
		} else {
			avatar.resetColorAlpha();
//			blood.on = false;
		}
		
		hp.scale.x = health_percent;
		exp.scale.x = (width / exp.width) * Dungeon.hero.exp / Dungeon.hero.maxExp();
		
		if (Dungeon.hero.lvl != lastLvl) {
			
			if (lastLvl != -1) {
				Emitter emitter = (Emitter)recycle( Emitter.class );
				emitter.revive();
				emitter.pos( 26, 26 );
				emitter.burst( Speck.factory( Speck.STAR ), 12 );
			}
			
			lastLvl = Dungeon.hero.lvl;
			level.text( Integer.toString( lastLvl ) );
			level.measure();
			level.x = PixelScene.align( 26.0f - level.width() / 2 );
			level.y = PixelScene.align( 26.5f - level.baseLine() / 2 );

		}

        health.text( String.format( "%d/%d", Dungeon.hero.HP, Dungeon.hero.HT ) );
        health.measure();
        health.x = PixelScene.align( 53.0f - health.width() / 2 );
        health.y = PixelScene.align( 4.0f - health.baseLine() / 2 );
        health.alpha( 0.5f );

		int k = IronKey.curDepthQuantity;
		if (k != lastKeys) {
			lastKeys = k;
			keys.text(Integer.toString(lastKeys));
			keys.measure();
			keys.x = width - 8 - keys.width()    - 18;
		}

		
		int tier = Dungeon.hero.appearance();
		if (tier != lastTier) {
			lastTier = tier;
			avatar.copy( HeroSprite.avatar( Dungeon.hero.heroClass, tier ) );
		}
	}
 
Example 3
Source File: StatusPane.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void update() {
	super.update();

	float health = (float)Dungeon.hero.HP / Dungeon.hero.HT;

	if (health == 0) {
		avatar.tint( 0x000000, 0.6f );
		blood.on = false;
	} else if (health < 0.25f) {
		avatar.tint( 0xcc0000, 0.4f );
		blood.on = true;
	} else {
		avatar.resetColor();
		blood.on = false;
	}

	hp.scale.x = health;
	exp.scale.x = (width / exp.width) * Dungeon.hero.exp / Dungeon.hero.maxExp();

	if (Dungeon.hero.lvl != lastLvl) {

		if (lastLvl != -1) {
			Emitter emitter = (Emitter)recycle( Emitter.class );
			emitter.revive();
			emitter.pos( 27, 27 );
			emitter.burst( Speck.factory( Speck.STAR ), 12 );
		}

		lastLvl = Dungeon.hero.lvl;
		level.text( Integer.toString( lastLvl ) );
		level.measure();
		level.x = PixelScene.align( 27.0f - level.width() / 2 );
		level.y = PixelScene.align( 27.5f - level.baseLine() / 2 );
	}

	int k = IronKey.curDepthQuantity;
	if (k != lastKeys) {
		lastKeys = k;
		keys.text( Integer.toString( lastKeys ) );
		keys.measure();
		keys.x = width - 8 - keys.width()    - 18;
	}

	int tier = Dungeon.hero.tier();
	if (tier != lastTier) {
		lastTier = tier;
		avatar.copy( HeroSprite.avatar( Dungeon.hero.heroClass, tier ) );
	}
}
 
Example 4
Source File: StatusPane.java    From pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void update() {
	super.update();
	
	if (tagDanger != danger.visible || tagLoot != loot.visible || tagResume != resume.visible) {
		
		tagDanger = danger.visible;
		tagLoot = loot.visible;
		tagResume = resume.visible;
		
		layoutTags();
	}
	
	float health = (float)Dungeon.hero.HP / Dungeon.hero.HT;
	
	if (health == 0) {
		avatar.tint( 0x000000, 0.6f );
		blood.on = false;
	} else if (health < 0.25f) {
		avatar.tint( 0xcc0000, 0.4f );
		blood.on = true;
	} else {
		avatar.resetColor();
		blood.on = false;
	}
	
	hp.scale.x = health;
	exp.scale.x = (width / exp.width) * Dungeon.hero.exp / Dungeon.hero.maxExp();
	
	if (Dungeon.hero.lvl != lastLvl) {
		
		if (lastLvl != -1) {
			Emitter emitter = (Emitter)recycle( Emitter.class );
			emitter.revive();
			emitter.pos( 27, 27 );
			emitter.burst( Speck.factory( Speck.STAR ), 12 );
		}
		
		lastLvl = Dungeon.hero.lvl;
		level.text( Integer.toString( lastLvl ) );
		level.measure();
		level.x = PixelScene.align( 27.5f - level.width() / 2 );
		level.y = PixelScene.align( 28.0f - level.baseLine() / 2 );
	}
	
	int k = IronKey.curDepthQuantity;
	if (k != lastKeys) {
		lastKeys = k;
		keys.text( Integer.toString( lastKeys ) );
		keys.measure();
		keys.x = width - 8 - keys.width()    - 18;
	}
	
	int tier = Dungeon.hero.tier();
	if (tier != lastTier) {
		lastTier = tier;
		avatar.copy( HeroSprite.avatar( Dungeon.hero.heroClass, tier ) );
	}
}
 
Example 5
Source File: StatusPane.java    From shattered-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void update() {
	super.update();
	
	float health = Dungeon.hero.HP;
	float shield = Dungeon.hero.shielding();
	float max = Dungeon.hero.HT;

	if (!Dungeon.hero.isAlive()) {
		avatar.tint(0x000000, 0.5f);
	} else if ((health/max) < 0.3f) {
		warning += Game.elapsed * 5f *(0.4f - (health/max));
		warning %= 1f;
		avatar.tint(ColorMath.interpolate(warning, warningColors), 0.5f );
	} else {
		avatar.resetColor();
	}

	hp.scale.x = Math.max( 0, (health-shield)/max);
	shieldedHP.scale.x = health/max;
	rawShielding.scale.x = shield/max;

	exp.scale.x = (width / exp.width) * Dungeon.hero.exp / Dungeon.hero.maxExp();

	if (Dungeon.hero.lvl != lastLvl) {

		if (lastLvl != -1) {
			Emitter emitter = (Emitter)recycle( Emitter.class );
			emitter.revive();
			emitter.pos( 27, 27 );
			emitter.burst( Speck.factory( Speck.STAR ), 12 );
		}

		lastLvl = Dungeon.hero.lvl;
		level.text( Integer.toString( lastLvl ) );
		level.measure();
		level.x = 27.5f - level.width() / 2f;
		level.y = 28.0f - level.baseLine() / 2f;
		PixelScene.align(level);
	}

	int tier = Dungeon.hero.tier();
	if (tier != lastTier) {
		lastTier = tier;
		avatar.copy( HeroSprite.avatar( Dungeon.hero.heroClass, tier ) );
	}
}
 
Example 6
Source File: StatusPane.java    From remixed-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void update() {
    super.update();

    float health = (float) hero.getControlTarget().hp() / hero.getControlTarget().ht();

    float sPoints = 0;
    if(hero.getControlTarget().getId() == hero.getId()) {
        sPoints=(float) hero.getSkillPoints() / hero.getSkillPointsMax();
    }

    if(avatar!=hero.getControlTarget().getSprite().avatar()) {
        remove(avatar);
        avatar = hero.getControlTarget().getSprite().avatar();
        add(avatar);
        layout();
    }

    if (health == 0) {
        avatar.tint(0x000000, 0.6f);
        blood.on = false;
    } else if (health < 0.25f) {
        avatar.tint(0xcc0000, 0.4f);
        blood.on = true;
    } else {
        avatar.resetColor();
        blood.on = false;
    }

    hp.Scale().x = health;
    sp.Scale().x = sPoints;
    exp.Scale().x = (width / exp.width) * hero.getExp() / hero.maxExp();

    if (hero.lvl() != lastLvl) {

        if (lastLvl != -1) {
            Emitter emitter = (Emitter) recycle(Emitter.class);
            emitter.revive();
            emitter.pos(27, 27);
            emitter.burst(Speck.factory(Speck.STAR), 12);
        }

        lastLvl = hero.lvl();
        level.text(Integer.toString(lastLvl));
        level.x = PixelScene.align(27.0f - level.width() / 2);
        level.y = PixelScene.align(27.5f - level.baseLine() / 2);
    }

    int k = IronKey.curDepthQuantity;
    if (k != lastKeys) {
        lastKeys = k;
        keys.text(Integer.toString(lastKeys));
        keys.x = width - 8 - keys.width() - 18;
    }
}
 
Example 7
Source File: StatusPane.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void update() {
	super.update();
	
	float health = Dungeon.hero.HP;
	float shield = Dungeon.hero.shielding();
	float max = Dungeon.hero.HT;

	if (!Dungeon.hero.isAlive()) {
		avatar.tint(0x000000, 0.5f);
	} else if ((health/max) < 0.3f) {
		warning += Game.elapsed * 5f *(0.4f - (health/max));
		warning %= 1f;
		avatar.tint(ColorMath.interpolate(warning, warningColors), 0.5f );
	} else {
		avatar.resetColor();
	}

	hp.scale.x = Math.max( 0, (health-shield)/max);
	shieldedHP.scale.x = health/max;
	rawShielding.scale.x = shield/max;

	exp.scale.x = (width / exp.width) * Dungeon.hero.exp / Dungeon.hero.maxExp();

	if (Dungeon.hero.lvl != lastLvl) {

		if (lastLvl != -1) {
			Emitter emitter = (Emitter)recycle( Emitter.class );
			emitter.revive();
			emitter.pos( 27, 27 );
			emitter.burst( Speck.factory( Speck.STAR ), 12 );
		}

		lastLvl = Dungeon.hero.lvl;
		level.text( Integer.toString( lastLvl ) );
		level.measure();
		level.x = 27.5f - level.width() / 2f;
		level.y = 28.0f - level.baseLine() / 2f;
		PixelScene.align(level);
	}

	int tier = Dungeon.hero.tier();
	if (tier != lastTier) {
		lastTier = tier;
		avatar.copy( HeroSprite.avatar( Dungeon.hero.heroClass, tier ) );
	}
}