So some of you pretty much know I've moved from Code.org's programming 'thing'. For those of you doing ES6 JavaScript, here's a mining animation I made if anyone wants it:
`
//declare this.allowed and set it to false, declare this.clicked and set it to true. declare this.rotation = 0 in your constructor
const angle = Math.atan2(mouse.y - this.y, mouse.x - this.x);
this.rotation = angle;
if (this.clicked == true && this.rotationOff > -1.5) this.rotationOff -= Math.PI / 15
if (this.rotationOff <= -1.5) {
this.rotationOff += Math.PI / 15;
this.clicked = false;
} else if (this.rotationOff == 0) this.allowed = true
if(this.rotationOff > -1.5 && this.rotationOff < 0 && this.clicked == false) this.rotationOff += Math.PI / 15
if(this.rotationOff > 0) {
this.rotationOff = 0
if(mouse.holding == true) {
this.clicked = true
}
}
//declare mouse.holding = false
addEventListener('mouseup', (event) => {mouse.holding = false})
addEventListener('mouseup', (event) => {mouse.holding = true})
`
If you don't understand just dont worry about it.