test1 / enemy.js
Chronos234's picture
Update enemy.js
90de496 verified
raw
history blame
344 Bytes
class Enemy {
constructor(x, y) {
this.x = x;
this.y = y;
this.size = 30;
this.speed = 1;
}
update() {
this.move();
this.draw();
}
move() {
this.y += this.speed;
}
draw() {
ctx.beginPath();
ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
ctx.fillStyle = 'red';
ctx.fill();
}
}