xxxxxxxxxx
20
class Burger {
constructor(x,y,speed){
this.x = x;
this.y = y;
this.speed = speed;
this.direction = 1;
this.burger = loadImage("burger.png")
}
move(speed) {
this.xspeed = speed;
this.x += speed * this.direction;
if (this.x + 100 > width || x < -burger.width) {
this.direction *= -1;
}
}
display(){
image(this.burger, this.x, this.y)
}
}