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

The following examples show how to use com.watabou.noosa.particles.Emitter#burst() . 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: Spark.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 5 votes vote down vote up
public static void at( PointF p, final int color, int n ) {
	
	if (n <= 0) {
		return;
	}
	
	Emitter emitter = GameScene.emitter();
	emitter.pos( p );
	
	FACTORY.color = color;
	FACTORY.dir = -3.1415926f / 2;
	FACTORY.cone = 3.1415926f;
	emitter.burst( FACTORY, n );
}
 
Example 2
Source File: Spark.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 5 votes vote down vote up
public static void at( PointF p, final float dir, final float cone, final int color, int n ) {
	
	if (n <= 0) {
		return;
	}
	
	Emitter emitter = GameScene.emitter();
	emitter.pos( p );
	
	FACTORY.color = color;
	FACTORY.dir = dir;
	FACTORY.cone = cone;
	emitter.burst( FACTORY, n );
}
 
Example 3
Source File: Splash.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 5 votes vote down vote up
public static void at( PointF p, final int color, int n ) {
	
	if (n <= 0) {
		return;
	}
	
	Emitter emitter = GameScene.emitter();
	emitter.pos( p );
	
	FACTORY.color = color;
	FACTORY.dir = -3.1415926f / 2;
	FACTORY.cone = 3.1415926f;
	emitter.burst( FACTORY, n );
}
 
Example 4
Source File: Splash.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 5 votes vote down vote up
public static void at( PointF p, final float dir, final float cone, final int color, int n ) {
	
	if (n <= 0) {
		return;
	}
	
	Emitter emitter = GameScene.emitter();
	emitter.pos( p );
	
	FACTORY.color = color;
	FACTORY.dir = dir;
	FACTORY.cone = cone;
	emitter.burst( FACTORY, n );
}
 
Example 5
Source File: Splash.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public static void at( PointF p, final float dir, final float cone, final int color, int n ) {
	
	if (n <= 0) {
		return;
	}
	
	Emitter emitter = GameScene.emitter();
	emitter.pos( p );
	
	FACTORY.color = color;
	FACTORY.dir = dir;
	FACTORY.cone = cone;
	emitter.burst( FACTORY, n );
}
 
Example 6
Source File: Splash.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public static void at( PointF p, final int color, int n ) {
	
	if (n <= 0) {
		return;
	}
	
	Emitter emitter = GameScene.emitter();
	emitter.pos( p );
	
	FACTORY.color = color;
	FACTORY.dir = -3.1415926f / 2;
	FACTORY.cone = 3.1415926f;
	emitter.burst( FACTORY, n );
}
 
Example 7
Source File: Splash.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public static void at( PointF p, final int color, int n ) {
	
	if (n <= 0) {
		return;
	}
	
	Emitter emitter = GameScene.emitter();
	emitter.pos( p );
	
	FACTORY.color = color;
	FACTORY.dir = -3.1415926f / 2;
	FACTORY.cone = 3.1415926f;
	emitter.burst( FACTORY, n );
}
 
Example 8
Source File: Splash.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public static void at( PointF p, final float dir, final float cone, final int color, int n ) {
	
	if (n <= 0) {
		return;
	}
	
	Emitter emitter = GameScene.emitter();
	emitter.pos( p );
	
	FACTORY.color = color;
	FACTORY.dir = dir;
	FACTORY.cone = cone;
	emitter.burst( FACTORY, n );
}
 
Example 9
Source File: Splash.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public static void at( PointF p, final int color, int n ) {
	
	if (n <= 0) {
		return;
	}
	
	Emitter emitter = GameScene.emitter();
	emitter.pos( p );
	
	FACTORY.color = color;
	FACTORY.dir = -3.1415926f / 2;
	FACTORY.cone = 3.1415926f;
	emitter.burst( FACTORY, n );
}
 
Example 10
Source File: Splash.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public static void at( PointF p, final float dir, final float cone, final int color, int n ) {
	
	if (n <= 0) {
		return;
	}
	
	Emitter emitter = GameScene.emitter();
	emitter.pos( p );
	
	FACTORY.color = color;
	FACTORY.dir = dir;
	FACTORY.cone = cone;
	emitter.burst( FACTORY, n );
}
 
Example 11
Source File: Splash.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public static void at( PointF p, final float dir, final float cone, final int color, int n ) {
	
	if (n <= 0) {
		return;
	}
	
	Emitter emitter = GameScene.emitter();
	emitter.pos( p );
	
	FACTORY.color = color;
	FACTORY.dir = dir;
	FACTORY.cone = cone;
	emitter.burst( FACTORY, n );
}
 
Example 12
Source File: Splash.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public static void at( PointF p, final int color, int n ) {
	
	if (n <= 0) {
		return;
	}
	
	Emitter emitter = GameScene.emitter();
	emitter.pos( p );
	
	FACTORY.color = color;
	FACTORY.dir = -3.1415926f / 2;
	FACTORY.cone = 3.1415926f;
	emitter.burst( FACTORY, n );
}
 
Example 13
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 14
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 ) );
	}
}
 
Example 15
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 16
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 17
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 18
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 19
Source File: LightningTrap.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 3 votes vote down vote up
public static void trigger( int pos, Char ch ) {

        Level.set( pos, Terrain.INACTIVE_TRAP );

        int[] tiles = Random.Int( 2 ) == 0 ? Level.NEIGHBOURS5 : Level.NEIGHBOURSX ;

        Emitter emitter = CellEmitter.center( pos );
        emitter.burst( SparkParticle.FACTORY, Random.Int( 4, 6 ) );

        for( int n : tiles ) {

            ch = Actor.findChar( pos + n );

            if (ch != null) {

                int power = 10 + Dungeon.chapter() * 3;

                power = Random.IntRange( power / 2, power );

                ch.damage(n == 0 ? power : power / 2, TRAP, Element.SHOCK);

            }

            if( Dungeon.visible[ pos ] ) {
                emitter.parent.add( new Lightning( pos, pos + n ) );
            }

        }
	}
 
Example 20
Source File: Thunderstorm.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 2 votes vote down vote up
public static void thunderstrike( int cell, Blob blob ) {

        Emitter emitter = CellEmitter.get( cell );

        int[] tiles = Random.Int( 2 ) == 0 ? Level.NEIGHBOURS5 : Level.NEIGHBOURSX ;

        for( int n : tiles ) {

            Char ch = Actor.findChar( cell + n );

            if (ch != null) {

                int power = Random.IntRange(ch.HT / 3, ch.HT * 2 / 3);

                if( Bestiary.isBoss(ch) ) {
                    power = power / 4;
                } else if ( ch instanceof Hero ) {
                    power = power / 2;
                }


                ch.damage(n == 0 ? power : power / 2, blob, Element.SHOCK);

            }

            if( Dungeon.visible[ cell + n ] ) {
                emitter.parent.add( new Lightning( cell, cell + n ) );
            }

        }

        if( Dungeon.visible[ cell ] ){
            emitter.burst( SparkParticle.FACTORY, Random.Int( 4, 6 ) );
        }

        for (Mob mob : Dungeon.level.mobs) {
            if (Level.distance( cell, mob.pos ) <= 4 ) {
                mob.beckon(cell);
            }
        }
    }