| 1 | import { randItem } from '../utils.js' |
| 2 | import Actor from './Actor.js' |
| 3 | |
| 4 | const VARIANTS = ['cactus', 'cactusDouble', 'cactusDoubleB', 'cactusTriple'] |
| 5 | |
| 6 | export default class Cactus extends Actor { |
| 7 | constructor(imageData) { |
| 8 | super(imageData) |
| 9 | this.sprite = randItem(VARIANTS) |
| 10 | // these are dynamically set by the game |
| 11 | this.speed = null |
| 12 | this.x = null |
| 13 | this.y = null |
| 14 | } |
| 15 | |
| 16 | nextFrame() { |
| 17 | this.x -= this.speed |
| 18 | } |
| 19 | } |