Untitled

 avatar
unknown
plain_text
7 months ago
408 B
2
Indexable
class Box{
    constructor(x,y,width,height){
        var options={
            restitution:1
        }
      this.body =Bodies.rectangle(x,y,width,height,options)
      this.width=width;
      this.height=height;
        World.add(world,this.body);
    }
    display(){
        var pos= this.body.position
        rectMode(CENTER);
        fill(255);
        rect(pos.x,pos.y,this.width,this.height)
    }

Editor is loading...
Leave a Comment