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

The following examples show how to use com.watabou.noosa.particles.Emitter#pos() . 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: 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 2
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 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 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 5
Source File: BlacksmithSprite.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void link( Char ch ) {
	super.link( ch );
	
	emitter = new Emitter();
	emitter.autoKill = false;
	emitter.pos( x + 7, y + 12 );
	parent.add( emitter );
}
 
Example 6
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 7
Source File: BlacksmithSprite.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void link( Char ch ) {
	super.link( ch );
	
	emitter = new Emitter();
	emitter.autoKill = false;
	emitter.pos( x + 7, y + 12 );
	parent.add( emitter );
}
 
Example 8
Source File: CharSprite.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 5 votes vote down vote up
public Emitter bottomEmitter() {
    Emitter emitter = GameScene.emitter();
    emitter.pos(this);
    emitter.y = height;
    emitter.height = -height / 2;
    return emitter;
}
 
Example 9
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 10
Source File: CharSprite.java    From remixed-dungeon with GNU General Public License v3.0 4 votes vote down vote up
public Emitter bottomEmitter() {
    Emitter emitter = GameScene.emitter();
    emitter.pos(x, y + height, width, 0);
    return emitter;
}
 
Example 11
Source File: StatusPane.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void createChildren() {

	shield = new NinePatch( Assets.STATUS, 80, 0, 30   + 18, 0 );
	add( shield );

	add( new TouchArea( 0, 1, 31, 31 ) {
		@Override
		protected void onClick( Touch touch ) {
			Image sprite = Dungeon.hero.sprite;
			if (!sprite.isVisible()) {
				Camera.main.focusOn( sprite );
			}
			GameScene.show( new WndHero() );
		}
	} );

	btnMenu = new MenuButton();
	add( btnMenu );

	avatar = HeroSprite.avatar( Dungeon.hero.heroClass, lastTier );
	add( avatar );

	blood = new Emitter();
	blood.pos( avatar );
	blood.pour( BloodParticle.FACTORY, 0.3f );
	blood.autoKill = false;
	blood.on = false;
	add( blood );

	compass = new Compass( Dungeon.level.exit );
	add( compass );

	hp = new Image( Assets.HP_BAR );
	add( hp );

	exp = new Image( Assets.XP_BAR );
	add( exp );

	level = new BitmapText( PixelScene.font1x );
	level.hardlight( 0xFFEBA4 );
	add( level );

	depth = new BitmapText( Integer.toString( Dungeon.depth ), PixelScene.font1x );
	depth.hardlight( 0xCACFC2 );
	depth.measure();
	add( depth );

	Dungeon.hero.belongings.countIronKeys();
	keys = new BitmapText( PixelScene.font1x );
	keys.hardlight( 0xCACFC2 );
	add( keys );

	danger = new DangerIndicator();
	add( danger );

	buffs = new BuffIndicator( Dungeon.hero );
	add( buffs );
}
 
Example 12
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 13
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 14
Source File: CharSprite.java    From shattered-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
public Emitter bottomEmitter() {
	Emitter emitter = GameScene.emitter();
	emitter.pos( x, y + height, width, 0 );
	return emitter;
}
 
Example 15
Source File: CellEmitter.java    From remixed-dungeon with GNU General Public License v3.0 3 votes vote down vote up
public static Emitter bottom( int cell ) {
	
	PointF p = DungeonTilemap.tileToWorld( cell );
	
	Emitter emitter = GameScene.emitter();
	emitter.pos( p.x, p.y + DungeonTilemap.SIZE, DungeonTilemap.SIZE, 0 );
	
	return emitter;
}
 
Example 16
Source File: CellEmitter.java    From shattered-pixel-dungeon with GNU General Public License v3.0 3 votes vote down vote up
public static Emitter bottom( int cell ) {
	
	PointF p = DungeonTilemap.tileToWorld( cell );
	
	Emitter emitter = GameScene.emitter();
	emitter.pos( p.x, p.y + DungeonTilemap.SIZE, DungeonTilemap.SIZE, 0 );
	
	return emitter;
}
 
Example 17
Source File: CellEmitter.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 3 votes vote down vote up
public static Emitter center( int cell ) {
	
	PointF p = DungeonTilemap.tileToWorld( cell );
	
	Emitter emitter = GameScene.emitter();

       if( emitter != null)
	    emitter.pos( p.x + DungeonTilemap.SIZE / 2, p.y + DungeonTilemap.SIZE / 2 );
	
	return emitter;
}
 
Example 18
Source File: CellEmitter.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 3 votes vote down vote up
public static Emitter bottom( int cell ) {

        PointF p = DungeonTilemap.tileToWorld( cell );

        Emitter emitter = GameScene.emitter();

        if( emitter != null)
            emitter.pos( p.x, p.y + DungeonTilemap.SIZE / 2, DungeonTilemap.SIZE, DungeonTilemap.SIZE / 2 );

        return emitter;
    }
 
Example 19
Source File: CellEmitter.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 3 votes vote down vote up
public static Emitter get( int cell ) {
	
	PointF p = DungeonTilemap.tileToWorld( cell );
	
	Emitter emitter = GameScene.emitter();
	emitter.pos( p.x, p.y, DungeonTilemap.SIZE, DungeonTilemap.SIZE );
	
	return emitter;
}
 
Example 20
Source File: CellEmitter.java    From shattered-pixel-dungeon with GNU General Public License v3.0 3 votes vote down vote up
public static Emitter center( int cell ) {
	
	PointF p = DungeonTilemap.tileToWorld( cell );
	
	Emitter emitter = GameScene.emitter();
	emitter.pos( p.x + DungeonTilemap.SIZE / 2, p.y + DungeonTilemap.SIZE / 2 );
	
	return emitter;
}