silphius/resources/kitty/initial.js
2024-11-04 11:28:37 -06:00

15 lines
530 B
JavaScript

import * as Math from '@/lib/math.js';
import Ticker from '@/lib/ticker.js';
export default function*({entity}) {
const {Controlled, Direction, Sprite} = entity;
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;
}