blob: c397332e49e1c1c6d78b99ac2150f46451e5c124 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
import { canvas, PLAYER_VEL } from "../consts";
import Enemy from "./Enemy";
export default class Straight extends Enemy {
width = 20;
height = 20;
sprite = "blue";
vel = PLAYER_VEL * 0.8
move() {
if (this.y + this.height > canvas.height) { this.y = canvas.height - this.height; }
else if (this.y === canvas.height - this.height) { this.vel *= -1; this.y += this.vel; }
else { this.y += this.vel; }
return this.y + this.height < 0
}
}
|