14 lines
515 B
JavaScript
14 lines
515 B
JavaScript
import * as Math from '@/util/math.js';
|
|
import Ticker from '@/util/ticker.js';
|
|
|
|
export default function*({entity: {Controlled, Direction, Sprite}}) {
|
|
Direction.direction = Math.random() * Math.TAU;
|
|
Controlled.directionMove(Direction.direction);
|
|
yield Ticker.wait(0.25 + Math.random() * 2.25);
|
|
Controlled.stop();
|
|
Sprite.isAnimating = 0;
|
|
yield Ticker.wait(1 + Math.random() * 3);
|
|
Direction.direction = Math.random() * Math.TAU;
|
|
yield Ticker.wait(0.5 + Math.random() * 2.5);
|
|
Sprite.isAnimating = 1;
|
|
} |