Class AttackPainter
java.lang.Object
games.stendhal.client.gui.j2d.entity.helpers.AttackPainter
An utility for drawing the attack sprites.
-
Method Summary
Modifier and TypeMethodDescriptionvoiddraw(Graphics2D g2d, Direction direction, int x, int y, int width, int height) Draw a melee attack.voiddrawDistanceAttack(Graphics2D g2d, RPEntity entity, IEntity target, int x, int y, int width, int height) Draw a distance attack line.static AttackPainterGet a painter for attack of a given nature, and size of a creature.booleanhasNatureAndWeapon(Nature nature, String weapon) Check if this painter has the given nature an weapon.booleanCheck if the current attack has been completely drawn.voidPrepare for an attack to a given direction.
-
Method Details
-
get
Get a painter for attack of a given nature, and size of a creature.- Parameters:
nature- attack natureweapon- weapon, ornullif not specifiedsize- creature size- Returns:
- painter
-
draw
Draw a melee attack.- Parameters:
g2d- graphicsdirection- attack directionx- x coordinatey- y coordinatewidth- entity widthheight- entity height
-
drawDistanceAttack
public void drawDistanceAttack(Graphics2D g2d, RPEntity entity, IEntity target, int x, int y, int width, int height) Draw a distance attack line.- Parameters:
g2d- graphicsentity- attacking entitytarget- attack targetx- attacker x coordinatey- attacker y coordinatewidth- attacker widthheight- attacker height
-
hasNatureAndWeapon
Check if this painter has the given nature an weapon.- Parameters:
nature- nature to compare toweapon- weapon to compare to- Returns:
trueif the painter has the given nature, otherwisefalse
-
isDoneAttacking
public boolean isDoneAttacking()Check if the current attack has been completely drawn.- Returns:
trueif drawing the attack has been completed, otherwisefalse
-
prepare
Prepare for an attack to a given direction.- Parameters:
direction- attack direction
-