2024-07-22 03:18:02 -05:00
|
|
|
const {Collider, Controlled, Interacts, Inventory, Sound, Sprite} = wielder
|
|
|
|
const entities = Collider.closest(Interacts.aabb());
|
|
|
|
for (const entity of entities) {
|
2024-07-24 01:40:10 -05:00
|
|
|
const {Emitter, Position, Tags} = entity;
|
2024-07-22 03:18:02 -05:00
|
|
|
if (Tags && Tags.has('kittan')) {
|
|
|
|
Controlled.locked = 1
|
|
|
|
const [, direction] = Sprite.animation.split(':')
|
|
|
|
for (let i = 0; i < 2; ++i) {
|
2024-09-17 01:25:39 -05:00
|
|
|
Sound.play('/resources/brush/brush.wav');
|
2024-07-22 03:18:02 -05:00
|
|
|
Sprite.animation = ['moving', direction].join(':');
|
|
|
|
await wait(0.3)
|
|
|
|
Sprite.animation = ['idle', direction].join(':');
|
|
|
|
await wait(0.1)
|
|
|
|
}
|
|
|
|
Inventory.give({
|
|
|
|
qty: 1,
|
2024-09-17 01:25:39 -05:00
|
|
|
source: '/resources/furball/furball.json',
|
2024-07-22 03:18:02 -05:00
|
|
|
});
|
|
|
|
Controlled.locked = 0;
|
2024-07-24 01:40:10 -05:00
|
|
|
|
|
|
|
const heartParticles = {
|
|
|
|
behaviors: [
|
|
|
|
{
|
|
|
|
type: 'moveAcceleration',
|
|
|
|
config: {
|
|
|
|
accel: {
|
|
|
|
x: 0,
|
|
|
|
y: -100,
|
|
|
|
},
|
|
|
|
minStart: 0,
|
|
|
|
maxStart: 0,
|
|
|
|
rotate: false,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'moveSpeed',
|
|
|
|
config: {
|
|
|
|
speed: {
|
|
|
|
list: [
|
|
|
|
{
|
|
|
|
time: 0,
|
|
|
|
value: 30
|
|
|
|
},
|
|
|
|
{
|
|
|
|
time: 1,
|
|
|
|
value: 0
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'scale',
|
|
|
|
config: {
|
|
|
|
scale: {
|
|
|
|
list: [
|
|
|
|
{
|
|
|
|
value: 0.5,
|
|
|
|
time: 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 0.125,
|
|
|
|
time: 1,
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'textureSingle',
|
|
|
|
config: {
|
2024-09-17 01:25:39 -05:00
|
|
|
texture: '/resources/heart/heart.png',
|
2024-07-24 01:40:10 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
],
|
|
|
|
lifetime: {
|
|
|
|
min: 0.5,
|
|
|
|
max: 0.5,
|
|
|
|
},
|
|
|
|
frequency: 0.1,
|
|
|
|
emitterLifetime: 0.25,
|
|
|
|
pos: {
|
|
|
|
x: 0,
|
|
|
|
y: 0
|
|
|
|
},
|
|
|
|
rotation: 180,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Emitter.emit({
|
|
|
|
...heartParticles,
|
|
|
|
behaviors: [
|
|
|
|
...heartParticles.behaviors,
|
|
|
|
{
|
|
|
|
type: 'spawnShape',
|
|
|
|
config: {
|
|
|
|
type: 'rect',
|
|
|
|
data: {
|
|
|
|
x: Position.x - 8,
|
|
|
|
y: Position.y,
|
|
|
|
w: 16,
|
|
|
|
h: 1,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|
2024-07-22 03:18:02 -05:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|