Last active
December 11, 2019 21:43
-
-
Save CodeDraken/f75420c8abe3c37fff08291e558c8877 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// properties and initial velocity | |
const defaultProps = { | |
bounce: 0.75, | |
radius: 30, | |
color: 'red', | |
// starting velocity | |
startVelX: (Math.random() * 15 + 5) * (Math.floor(Math.random() * 2) || -1), | |
startVelY: (Math.random() * 15 + 5) * (Math.floor(Math.random() * 2) || -1) | |
} | |
export class Ball { | |
constructor (x = 0, y = 0, sceneProps, props) { | |
this.props = { | |
...defaultProps, | |
...props | |
} | |
this.sceneProps = sceneProps | |
this.x = x | |
this.y = y | |
this.velX = this.props.startVelX | |
this.velY = this.props.startVelY | |
} | |
draw (ctx) { | |
} | |
update () { | |
} | |
} | |
export default Ball |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment