src/actors/Cloud.js 399 B raw
1
import { randInteger } from '../utils.js'
2
import Actor from './Actor.js'
3
4
export default class Cloud extends Actor {
5
  constructor(canvasWidth) {
6
    super()
7
    this.sprite = 'cloud'
8
    this.speedMod = randInteger(6, 14) / 10
9
    // these are dynamically set by the game
10
    this.speed = null
11
    this.x = null
12
    this.y = null
13
  }
14
15
  nextFrame() {
16
    this.x -= this.speed * this.speedMod
17
  }
18
}