SOURCE

class ball{
    constructor(X,Y,D,Tspeedx,Tspeedy)
    {
    this.ballx=X
    this.bally=Y
    this.d=D
    this.ballspeedx=Tspeedx
    this.ballspeedy=Tspeedy
    this.angle=(0)
    }

translating(){
    push()
    translate(this.ballx,this.bally)
    this.ballx +=random(-this.ballspeedx,this.ballspeedy)
    this.bally +=random(-this.ballspeedx,this.ballspeedy)
    }

drawing(){
    fill(255)
    ellipse(0,0,this.d,this.d)
    pop()
}
}
console 命令行工具 X clear

                    
>
console