# meta
```json
{
  "id": "flare-speed-burst",
  "name": "Flare speed burst",
  "tickRate": 30,
  "permissions": ["overlay.entities"]
}
```

# params
```json
{
  "initialSpeedMin": { "type": "number", "label": "Initial speed min", "default": 45 },
  "initialSpeedMax": { "type": "number", "label": "Initial speed max", "default": 75 },
  "acceleration": { "type": "number", "label": "Acceleration", "default": 18 },
  "explodeAtSpeed": { "type": "number", "label": "Explode at speed", "default": 320 },
  "explosionDurationMs": { "type": "number", "label": "Explosion duration ms", "default": 900 },
  "explosionRadius": { "type": "number", "label": "Explosion radius", "default": 320 },
  "hideAfterMs": { "type": "number", "label": "Hide after ms", "default": 900 }
}
```

# select
```json
{
  "flare": { "selectedPetId": "flare" }
}
```

# state
```json
{
  "flare": {
    "speed": 0,
    "direction": { "choice": [-1, 1] },
    "initialized": false,
    "exploded": false
  }
}
```

# tick
```json
[
  {
    "forEach": "flare",
    "do": [
      {
        "when": "!state.initialized",
        "do": [
          { "set": "state.speed", "value": "random(param.initialSpeedMin, param.initialSpeedMax)" },
          { "set": "state.initialized", "value": true }
        ]
      },
      { "set": "state.speed", "value": "state.speed + param.acceleration * dt" },
      { "moveX": "state.direction * state.speed * dt" },
      { "bounceX": { "bounds": "workarea", "flip": "state.direction" } },
      { "animation": { "direction": "state.direction", "left": "running-left", "right": "running-right" } },
      {
        "when": "state.speed >= param.explodeAtSpeed && !state.exploded",
        "do": [
          { "set": "state.exploded", "value": true },
          { "effect": "explosion", "durationMs": "param.explosionDurationMs", "radius": "param.explosionRadius" },
          { "hideAfter": "param.hideAfterMs" }
        ]
      }
    ]
  }
]
```
