#This function should run as an entity with the tag "tutorial"
scoreboard players remove stage astro_game.tutorial 1
scoreboard players set waiting_for_completion astro_game.tutorial 0
scoreboard players set arrow_highlight astro_game.tutorial 0
scoreboard players set waves astro_game.tutorial 0

scoreboard players set enabled astro_game.obstacles 1

scoreboard players set score astro_game.score 1000

function astro_game:game/clean

title @a[tag=game_viewer] times 2t 5t 2t
title @a[tag=game_viewer] title {text:"\uF830",font:"minecraft:al",type:"text"}

execute store result score random_buffer astro_game.tutorial run random value 1..6

stopsound @a[tag=game_viewer]

execute if score random_buffer astro_game.tutorial matches 1 run playsound sounds:fail_1 master @a[tag=game_viewer] ~ ~ ~ 1 1 1
execute if score random_buffer astro_game.tutorial matches 1 run scoreboard players set countdown astro_game.obstacles 38

execute if score random_buffer astro_game.tutorial matches 2 run playsound sounds:fail_2 master @a[tag=game_viewer] ~ ~ ~ 1 1 1
execute if score random_buffer astro_game.tutorial matches 2 run scoreboard players set countdown astro_game.obstacles 35

execute if score random_buffer astro_game.tutorial matches 3 run playsound sounds:fail_3 master @a[tag=game_viewer] ~ ~ ~ 1 1 1
execute if score random_buffer astro_game.tutorial matches 3 run scoreboard players set countdown astro_game.obstacles 37

execute if score random_buffer astro_game.tutorial matches 4 run playsound sounds:fail_4 master @a[tag=game_viewer] ~ ~ ~ 1 1 1
execute if score random_buffer astro_game.tutorial matches 4 run scoreboard players set countdown astro_game.obstacles 66

execute if score random_buffer astro_game.tutorial matches 5 run playsound sounds:fail_5 master @a[tag=game_viewer] ~ ~ ~ 1 1 1
execute if score random_buffer astro_game.tutorial matches 5 run scoreboard players set countdown astro_game.obstacles 58

execute if score random_buffer astro_game.tutorial matches 6 run playsound sounds:fail_6 master @a[tag=game_viewer] ~ ~ ~ 1 1 1
execute if score random_buffer astro_game.tutorial matches 6 run scoreboard players set countdown astro_game.obstacles 54
