Player

Manage and draw the player

Author
  • Mark Mayes / mm-dev
License
  • GPL-3.0-only
Source

Methods

(static) draw()

Source
Draw the character
  • If currently being damaged, flash a different colour based on the level background
  • If currently eating, flash a different colour based on the eaten obstacle
  • Draw the tail/friction effect
  • At faster speeds, distort the circular shape into an ellipse to suggest stretching in the direction of travel
  • Add any extra layers such as hats etc

(static) init()

Source
Set a neutral start position

(static) setupForLevel()

Source
Set colour, health, size etc according to the current level configuration

(static) update()

Source
Update some properties of the player
  • The position to be drawn at
  • If currently damaged, or eating, decrement the counters for those states

(static) updateSizes()

Source
Update some variables to fit the current layout