Class: ball

ball(pos, radius)

Class containing all the information for one ball in a snowman

Constructor

new ball(pos, radius)

ball constructor function.
Parameters:
Name Type Description
pos p5.vector The position of the ball once it has finished growing
radius number The radius of the ball once it has finished growing
Source:

Methods

getwidth() → {number}

function to calculate the width of the ball after being stretched
Source:
Returns:
width of the ball
Type
number

grow()

increase the size of the ball by the given radius
Source:

isGrownUp() → {boolean}

function that returns if the ball has reached its final radius
Source:
Returns:
true if the ball's radius has reached it's final value.
Type
boolean

isHitBy(flake) → {boolean}

function to determine if the ball is hit by the given snowflake.
Parameters:
Name Type Description
flake snowflake The snowflake object to check for collision with
Source:
Returns:
true if the objects collide
Type
boolean

show()

draws the ball on the screen
Source:

Documentation generated by JSDoc 3.6.3 on Sat Jun 11 2022 20:52:08 GMT+0100 (BST)