functions/MiniGameFirework/functions/fly.ps1

param($rocket, $var, $canvas, $sound, $object)

<#
    fly normaly until explosion height.
#>

if ($rocket.Y -LT $rocket.Get('explosionY')) {
    $rocket.Move()
    $rocket.Redraw()
    return
}

<#
    explode at explosion height.
#>



# Play sound
$random = Get-Random -Minimum 1 -Maximum 4
$sound.Play("firework_explosion_0$random")

# Create explosion object into the group 'explosion'.
$explosion = $object.FromBlueprint('explosion')

$explosion.AddPos($rocket.position)

# Remove rocket and draw explosion.
$rocket.Remove()
$explosion.Draw()