Constructor
new Hangman(pos, width, height, strokeWeightopt, strokeColopt)
Constructs a new instance of Hangman
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
pos |
p5.Vector | The top left position | ||
width |
number | The width in pixels | ||
height |
number | The height in pixels | ||
strokeWeight |
number |
<optional> |
5 | The stroke weight |
strokeCol |
number |
<optional> |
255 | The stroke col |
- Source:
Methods
calculateLocations()
Calculates the locations of the parts of the drawing. Is called on
instantiation of the class as well as during resizing events.
- Source:
decreaseLives()
Decreases the lives by one.
- Source:
draw()
Draws elements of the hangman based on the input arguments. Uses the
fall through feature of the switch case to draw all the elements needed.
- Source:
drawBase()
Draws a base.
- Source:
drawHangingVertical()
Draws a hanging vertical.
- Source:
drawHead()
Draws a head.
- Source:
drawHorizontalPole()
Draws a horizontal pole.
- Source:
drawLeftArm()
Draws a left arm.
- Source:
drawLeftLeg()
Draws a left leg.
- Source:
drawRightArm()
Draws a right arm.
- Source:
drawRightLeg()
Draws a right leg.
- Source:
drawTorso()
Draws a torso.
- Source:
drawTriangleSupportLowerLeft()
Draws a triangle support lower left.
- Source:
drawTriangleSupportLowerRight()
Draws a triangle support lower right.
- Source:
drawTriangleSupportUpper()
Draws a triangle support upper.
- Source:
drawVerticalPole()
Draws a vertical pole.
- Source:
isDead() → {boolean}
Checks if the player is dead
- Source:
Returns:
True if dead, False otherwise.
- Type
- boolean
resize(pos, width, height)
Resize the drawing of the hangman
Parameters:
Name | Type | Description |
---|---|---|
pos |
p5.Vector | The top left position |
width |
number | The width in pixels |
height |
number | The height in pixels |
- Source: