Search in sources :

Example 1 with CharSprite

use of com.watabou.pixeldungeon.sprites.CharSprite in project pixel-dungeon by watabou.

the class MirrorImage method sprite.

@Override
public CharSprite sprite() {
    CharSprite s = super.sprite();
    ((MirrorSprite) s).updateArmor(tier);
    return s;
}
Also used : MirrorSprite(com.watabou.pixeldungeon.sprites.MirrorSprite) CharSprite(com.watabou.pixeldungeon.sprites.CharSprite)

Example 2 with CharSprite

use of com.watabou.pixeldungeon.sprites.CharSprite in project pixel-dungeon by watabou.

the class HealthIndicator method update.

@Override
public void update() {
    super.update();
    if (target != null && target.isAlive() && target.sprite.visible) {
        CharSprite sprite = target.sprite;
        bg.scale.x = sprite.width;
        level.scale.x = sprite.width * target.HP / target.HT;
        bg.x = level.x = sprite.x;
        bg.y = level.y = sprite.y - HEIGHT - 1;
        visible = true;
    } else {
        visible = false;
    }
}
Also used : CharSprite(com.watabou.pixeldungeon.sprites.CharSprite)

Example 3 with CharSprite

use of com.watabou.pixeldungeon.sprites.CharSprite in project pixel-dungeon-remix by NYRDS.

the class Mob method sprite.

public CharSprite sprite() {
    try {
        {
            String descName = "spritesDesc/" + getMobClassName() + ".json";
            if (ModdingMode.isResourceExist(descName) || ModdingMode.isAssetExist(descName)) {
                return new MobSpriteDef(descName, getKind());
            }
        }
        if (spriteClass instanceof Class) {
            CharSprite sprite = (CharSprite) ((Class<?>) spriteClass).newInstance();
            sprite.selectKind(getKind());
            return sprite;
        }
        if (spriteClass instanceof String) {
            return new MobSpriteDef((String) spriteClass, getKind());
        }
        throw new TrackedRuntimeException(String.format("sprite creation failed - mob class %s", getMobClassName()));
    } catch (Exception e) {
        throw new TrackedRuntimeException(e);
    }
}
Also used : TrackedRuntimeException(com.nyrds.android.util.TrackedRuntimeException) HeroClass(com.watabou.pixeldungeon.actors.hero.HeroClass) HeroSubClass(com.watabou.pixeldungeon.actors.hero.HeroSubClass) CharSprite(com.watabou.pixeldungeon.sprites.CharSprite) MobSpriteDef(com.watabou.pixeldungeon.sprites.MobSpriteDef) JSONException(org.json.JSONException) TrackedRuntimeException(com.nyrds.android.util.TrackedRuntimeException)

Example 4 with CharSprite

use of com.watabou.pixeldungeon.sprites.CharSprite in project pixel-dungeon by watabou.

the class Item method use.

public void use() {
    if (level > 0 && !isBroken()) {
        int threshold = (int) (maxDurability() * DURABILITY_WARNING_LEVEL);
        if (durability-- >= threshold && threshold > durability && levelKnown) {
            GLog.w(TXT_GONNA_BREAK, name());
        }
        if (isBroken()) {
            getBroken();
            if (levelKnown) {
                GLog.n(TXT_BROKEN, name());
                Dungeon.hero.interrupt();
                CharSprite sprite = Dungeon.hero.sprite;
                PointF point = sprite.center().offset(0, -16);
                if (this instanceof Weapon) {
                    sprite.parent.add(Degradation.weapon(point));
                } else if (this instanceof Armor) {
                    sprite.parent.add(Degradation.armor(point));
                } else if (this instanceof Ring) {
                    sprite.parent.add(Degradation.ring(point));
                } else if (this instanceof Wand) {
                    sprite.parent.add(Degradation.wand(point));
                }
                Sample.INSTANCE.play(Assets.SND_DEGRADE);
            }
        }
    }
}
Also used : Armor(com.watabou.pixeldungeon.items.armor.Armor) Ring(com.watabou.pixeldungeon.items.rings.Ring) PointF(com.watabou.utils.PointF) Wand(com.watabou.pixeldungeon.items.wands.Wand) CharSprite(com.watabou.pixeldungeon.sprites.CharSprite) Weapon(com.watabou.pixeldungeon.items.weapon.Weapon) MissileWeapon(com.watabou.pixeldungeon.items.weapon.missiles.MissileWeapon)

Example 5 with CharSprite

use of com.watabou.pixeldungeon.sprites.CharSprite in project pixel-dungeon by watabou.

the class GameScene method addMobSprite.

private void addMobSprite(Mob mob) {
    CharSprite sprite = mob.sprite();
    sprite.visible = Dungeon.visible[mob.pos];
    mobs.add(sprite);
    sprite.link(mob);
}
Also used : CharSprite(com.watabou.pixeldungeon.sprites.CharSprite)

Aggregations

CharSprite (com.watabou.pixeldungeon.sprites.CharSprite)7 TrackedRuntimeException (com.nyrds.android.util.TrackedRuntimeException)1 HeroClass (com.watabou.pixeldungeon.actors.hero.HeroClass)1 HeroSubClass (com.watabou.pixeldungeon.actors.hero.HeroSubClass)1 Armor (com.watabou.pixeldungeon.items.armor.Armor)1 Ring (com.watabou.pixeldungeon.items.rings.Ring)1 Wand (com.watabou.pixeldungeon.items.wands.Wand)1 Weapon (com.watabou.pixeldungeon.items.weapon.Weapon)1 MissileWeapon (com.watabou.pixeldungeon.items.weapon.missiles.MissileWeapon)1 MirrorSprite (com.watabou.pixeldungeon.sprites.MirrorSprite)1 MobSpriteDef (com.watabou.pixeldungeon.sprites.MobSpriteDef)1 PointF (com.watabou.utils.PointF)1 JSONException (org.json.JSONException)1