Merge pull request 'Updated docs to include modules for each feature' () from chore/update into main

Reviewed-on: 
This commit is contained in:
thepaperpilot 2025-01-31 13:56:13 +00:00
commit cf82764818
3 changed files with 22 additions and 3 deletions
docs/guide
important-concepts
recipes
profectus

View file

@ -6,8 +6,8 @@ For example, a cost function like `Decimal.pow(amount, 1.05).times(100)` can be
```ts
const myRepeatable = createRepeatable(() => ({
requirements: createCostRequirement(() => ({
resource: points,
requirements: createCostRequirement((): CostRequirementOptions => ({
resource: noPersist(points),
cost: Formula.variable(myRepeatable.amount).pow_base(1.05).times(100)
})),
maximize: true

View file

@ -63,6 +63,25 @@ watch(
This code watches for whether the node exists and the `boundingRect` exists, which are required to display the effect. You can additionally watch any other values that would have an impact on the particle effect, like whether or not it should be emitting.
For a "one-shot" animation (one that just gets played once when something happens and then deleted), you can simplify the code a bit:
```ts
watch(achievement.earned, earned => {
const rect = layer.nodes.value[achievement.id]?.rect;
const boundingRect = particles.boundingRect.value;
if (earned && rect != null && boundingRect != null) {
particles.addEmitter(particleEffect).then(emitter => {
emitter.updateOwnerPos(
rect.x + rect.width / 2 - boundingRect.x,
rect.y + rect.height / 2 - boundingRect.y
);
emitter.resetPositionTracking();
emitter.playOnceAndDestroy();
});
}
});
```
## Support Hot Reloading
If you're using hot reloading, you might need to reload the particle effect. Here's an example from Kronos of adding the callback to the particles constructor:

@ -1 +1 @@
Subproject commit 78394b83c4225f09405ec92eb6d291007c1230a7
Subproject commit 2c4d95b73d19132f5dca8f0571827445d0b2d194