functions - shaunclapperton/L3Programming GitHub Wiki

  • function mainLoop- the mainloop is a infinite loop used to run the program
  • function colorRect- this is used to draw the canvas background
  • function colorText- this is used to draw the text for the score and the game over screen at the end
  • function keyPressed- this function reacts when the space bar key is pressed and sets the variable to true when it is
  • function keyReleased- this function reacts when the key is released and sets the variable to false when it is\
  • function scoreCorrect- this function halfs the final score. This is because the score is calculated on the pipes crossed since it crosses two at once the value is halfed.
  • function up- this function is for the top part of the bar and generates random agps between the pipes whilst also making the gap large enough for the sprite to fit through.
  • function bottom- this function is for the bottom part of the bar and also generates random y pos to create gap between the pipes