xxxxxxxxxx
34
class bob{
constructor(x,y)
{
this.radius=30;
this.x=x;
this.y=y;
this.r=random(0,255);
this.g=random(0,255);
this.b=random(0,255);
this.body=Matter.Bodies.circle(this.x,this.y,this.radius,{restitution:1,density:1,frictionAir:0})
Matter.World.add(world,this.body)
}
display()
{
var pos=this.body.position;
push()
translate(pos.x,pos.y)
ellipseMode(RADIUS)
fill(this.r,this.g,this.b)
ellipse(0,0,this.radius,this.radius)
pop()
push()
fill(255)
noStroke()
text("press arrow key to start ",600,400)
pop()
}
}