/** * Instantiates a new miss effect. * * @param left the left */ public MissEffect(boolean left) { super(0, 0); AudioPlayer.playAudio("miss"); Animation anim = new Animation( FEResources.getTexture("miss"), 38, 26, 20, 5, 0, 0, .015f, chu.engine.anim.BlendModeArgs.ALPHA_BLEND) { @Override public void update() { super.update(); if (getFrame() == 17) setSpeed(.08f); } @Override public void done() { destroy(); } }; sprite.addAnimation("default", anim); this.left = left; renderDepth = FightStage.EFFECT_DEPTH; }
/** * Instantiates a new hud. * * @param u1 the u1 * @param u2 the u2 * @param stage the stage */ public HUD(Unit u1, Unit u2, FightStage stage) { super(0, 0); this.unit = u1; sign = stage.isLeft(u1) ? -1 : 1; this.stage = stage; if (battleStats == null) battleStats = FEResources.getTexture("gui_battleStats"); if (!CombatCalculator.shouldAttack(u1, u2, u1.getWeapon(), stage.getRange())) { hit = " -"; crit = " -"; dmg = " -"; } else { hit = String.format("%3d", Math.min(100, Math.max(CombatCalculator.hitRate(u1, u2), 0))); crit = String.format("%3d", Math.min(100, Math.max(u1.crit() - u2.dodge(), 0))); dmg = String.format( "%3d", Math.min(100, Math.max(CombatCalculator.calculatePreviewDamage(u1, u2), 0))); } renderDepth = FightStage.HUD_DEPTH; stage.addEntity( new ItemDisplay( FightStage.CENTRAL_AXIS + sign * 39 - 37, FightStage.FLOOR + 13, u1.getWeapon(), false)); }
public void render() { BitmapFont font = FEResources.getBitmapFont("default_med"); if (hasFocus) { Renderer.drawRectangle(x, y, x + width, y + height, renderDepth, FOCUSED); float linepos = x + font.getStringWidth(input.substring(0, cursorPos)) + 2; Renderer.drawRectangle( linepos, y + 1, linepos + 1, y + height - 1, renderDepth - 0.02f, CURSOR); } else { Renderer.drawRectangle(x, y, x + width, y + height, renderDepth, UNFOCUSED); } Renderer.drawString("default_med", input.toString(), x + 2, y + 5, renderDepth - 0.01f); }
public void render() { ClientOverworldStage cs = (ClientOverworldStage) stage; Renderer.translate(-cs.camX, -cs.camY); Renderer.addClip(0, 0, 368, 240, true); if (FEResources.hasTexture(functionalClassName().toLowerCase() + "_map_idle")) { Transform t = new Transform(); if (sprite.getAnimationName().equals("RIGHT")) { t.flipHorizontal(); t.setTranslation(14, 0); // Why do we have to do this? } Color mod = new Color(1.0f, 1.0f, 1.0f, 1.0f); t.setColor(mod); if (moved) { sprite.render(x + 1 + rX, y + 1 + rY, renderDepth, t, new ShaderArgs("greyscale")); } else { ShaderArgs args = PaletteSwapper.setup(this); sprite.render(x + 1 + rX, y + 1 + rY, renderDepth, t, args); } } else { Color c = !moved ? new Color(getPartyColor()) : new Color(128, 128, 128); Renderer.drawRectangle( x + 1 + rX, y + 1 + rY, x + 14 + rX, y + 14 + rY, ClientOverworldStage.UNIT_DEPTH, c); Renderer.drawString( "default_med", name.charAt(0) + "" + name.charAt(1), x + 2 + rX, y + 1 + rY, ClientOverworldStage.UNIT_DEPTH); } if (rescuedUnit != null) { counter += Game.getDeltaSeconds(); counter %= 1; if (counter > 0.5) { Renderer.render(rescue, 0, 0, 1, 1, x + 9, y + 7, x + 9 + 8, y + 7 + 8, renderDepth); } } Renderer.removeClip(); Renderer.translate(cs.camX, cs.camY); }
public void beginStep() { List<MouseEvent> mouseEvents = Game.getMouseEvents(); for (MouseEvent event : mouseEvents) { if (event.button == 0) { int mX = Math.round(event.x / Game.getScaleX()); int mY = Math.round((Game.getWindowHeight() - event.y) / Game.getScaleY()); boolean newHover = (mX >= x && mX < x + width && mY >= y && mY < y + height); hasFocus = newHover; } } super.beginStep(); if (hasFocus) { List<KeyboardEvent> keys = Game.getKeys(); for (KeyboardEvent ke : keys) { if (ke.state) { if (ke.key == FEResources.getKeyMapped(Keyboard.KEY_RETURN)) { send(); } } } } }
public TradeMenu(Unit u, float x, float y, boolean flip) { super(u, x, y); mug = FEResources.getTexture(u.name.toLowerCase() + "_mugshot"); this.flip = flip; }
static { if (Game.glContextExists()) rescue = FEResources.getTexture("rescue"); }