public Power( int type, int xref, int yref, Texture source, SpriteBatch draw, int costAmount, String[] desc, String name) { texture = getTextureRegion(type, source); this.draw = draw; try { this.icon = new Texture(draw.getResource("intellect.png")); } catch (IOException e) { e.printStackTrace(); } this.xref = xref; this.yref = yref; this.costAmount = costAmount; this.desc = desc; this.name = name; if (yref > 0) { activated = false; } else { activated = true; } }
public void onClick(Powers powers) { if (activated && purchased) { powers.currentPower = this; } else { try { powers.currentPower = new Power( 0, 0, 0, new Texture(draw.getResource("Player/powersselect.png")), draw, 0, new String[] {"Purchase a tome before", "can select//use it"}, "The Tome of the Poor"); } catch (IOException e) { } } }
public void render(int ox, int oy, BitmapFont font, int nw, int nh) { if (!activated) { draw.setColor(Color.BLACK); } else { if (purchased) { draw.setColor(Color.WHITE); } else { if (mouseHover) { draw.setColor(Color.GRAY); } else { draw.setColor(Color.DARK_GRAY); } } } draw.draw(texture, ox + (xref * nw), oy + (yref * nh), nw, nh); draw.draw(icon, 168 - ox + (xref * nw), 220 - oy + (yref * nh), 15, 15); font.drawText(draw, costAmount + "", 100 - ox + (xref * nw), 205 - oy + (yref * nh)); boundingBox = new Rectangle(ox + (xref * nw), oy + (yref * nh), nw, nh); draw.setColor(Color.WHITE); }
public void renderNoShift(int ox, int oy, BitmapFont font, int nw, int nh) { if (!activated) { draw.setColor(Color.BLACK); } else { if (purchased) { draw.setColor(Color.WHITE); } else { if (mouseHover) { draw.setColor(Color.GRAY); } else { draw.setColor(Color.DARK_GRAY); } } } draw.draw(texture, ox, oy, nw, nh); font.drawText(draw, costAmount + "", 100 - ox, 205 - oy); draw.setColor(Color.WHITE); }
public void renderJustImage(int ox, int oy, int nw, int nh) { draw.draw(texture, ox, oy, nw, nh); boundingBox = new Rectangle(ox, oy, nw, nh); draw.setColor(Color.WHITE); }