silphius/public/assets/brush/start.js
2024-07-22 03:18:02 -05:00

23 lines
679 B
JavaScript

const {Collider, Controlled, Interacts, Inventory, Sound, Sprite} = wielder
const entities = Collider.closest(Interacts.aabb());
for (const entity of entities) {
const {Tags} = entity;
if (Tags && Tags.has('kittan')) {
Controlled.locked = 1
const [, direction] = Sprite.animation.split(':')
for (let i = 0; i < 2; ++i) {
Sound.play('/assets/brush/brush.wav');
Sprite.animation = ['moving', direction].join(':');
await wait(0.3)
Sprite.animation = ['idle', direction].join(':');
await wait(0.1)
}
Inventory.give({
qty: 1,
source: '/assets/furball/furball.json',
});
Controlled.locked = 0;
break;
}
}