Spaces:
Running
Running
| 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(); | |
| } | |
| } | |