Skip to content

Commit

Permalink
MagmaRun: Added post-start timer to tell player start to run
Browse files Browse the repository at this point in the history
  • Loading branch information
VForiel committed Dec 10, 2023
1 parent bff361f commit 6dc7a5d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 9 deletions.
9 changes: 6 additions & 3 deletions minigames/data/magma_run/functions/game_tick.mcfunction
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

function #magma_run:destroy_sand
function #magma_run:fall

execute at @a[team=magma_run] as @e[tag=lobby.horse,distance=..3] run function lobby:horse/kill

execute if score $magma_run.post_start_timer data matches ..0 run function #magma_run:destroy_sand
execute if score $magma_run.post_start_timer data matches ..0 run function #magma_run:fall
function #magma_run:stop

execute at @a[team=magma_run] as @e[tag=lobby.horse,distance=..3] run function lobby:horse/kill
execute if score $magma_run.post_start_timer data matches 0.. run function magma_run:start/post_start
17 changes: 17 additions & 0 deletions minigames/data/magma_run/functions/start/post_start.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

scoreboard players remove $magma_run.post_start_timer data 1

scoreboard players operation $magma_run.post_start_timer.seconds data = $magma_run.post_start_timer data
scoreboard players operation $magma_run.post_start_timer.seconds data /= 20 const
scoreboard players add $magma_run.post_start_timer.seconds data 1


execute if score $magma_run.post_start_timer data matches 0..60 run title @a[team=magma_run] title {"score":{"name":"$magma_run.post_start_timer.seconds","objective":"data"},"color":"gold","bold":true,"italic":true}

execute if score $magma_run.post_start_timer data matches 0 run title @a[team=magma_run] title {"text":""}
execute if score $magma_run.post_start_timer data matches 0 run title @a[team=magma_run] subtitle {"text":""}

execute if score $magma_run.post_start_timer data matches 60 as @a[team=magma_run] at @s run playsound minecraft:entity.experience_orb.pickup master @s ~ ~ ~ 1 1 0
execute if score $magma_run.post_start_timer data matches 40 as @a[team=magma_run] at @s run playsound minecraft:entity.experience_orb.pickup master @s ~ ~ ~ 1 1 0
execute if score $magma_run.post_start_timer data matches 20 as @a[team=magma_run] at @s run playsound minecraft:entity.experience_orb.pickup master @s ~ ~ ~ 1 1 0
execute if score $magma_run.post_start_timer data matches 0 as @a[team=magma_run] at @s run playsound minecraft:entity.experience_orb.pickup master @s ~ ~ ~ 1 2 0
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,4 @@ function #lib:start_animation {\
size: 20,\
start_callback: "magma_run:start/start",\
cancel_callback: "magma_run:map/place_starting_signs"\
}

execute at @e[tag=lib.start_animation.magma_run] run title @a[distance=..21] times 0 90 5
execute at @e[tag=lib.start_animation.magma_run] run title @a[distance=..21] title {"text":" "}
execute at @e[tag=lib.start_animation.magma_run] run title @a[distance=..21] subtitle {"text":"START TO RUN!","color":"gold","bold":true,"italic":true}
}
9 changes: 8 additions & 1 deletion minigames/data/magma_run/functions/start/start.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
execute at @e[tag=lib.start_animation.magma_run] run team join magma_run @a[distance=..21]
execute at @e[tag=lib.start_animation.magma_run] run kill @e[tag=global.lobby_horse,distance=..21]
clear @a[team=magma_run]
tp @a[team=magma_run] -216 100 17

# execute at @e[tag=lib.start_animation.magma_run] run title @a[distance=..21] times 0 90 5
# execute at @e[tag=lib.start_animation.magma_run] run title @a[distance=..21] title {"text":" "}
execute at @e[tag=lib.start_animation.magma_run] run title @a[distance=..21] subtitle {"text":"START TO RUN!","color":"gold","bold":true,"italic":true}

execute as @a[team=magma_run] at @s run function #global:animated_title {type:"start"}
execute as @a[team=magma_run] at @s run stopsound @s record
Expand All @@ -11,4 +16,6 @@ execute as @a[team=magma_run] at @s run tellraw @s {"text":"Music by Oleksii Hol
effect give @a[team=magma_run] speed infinite 2 true
scoreboard players set $magma_run.game_started data 1

function magma_run:map/lock
function magma_run:map/lock

scoreboard players set $magma_run.post_start_timer data 100

0 comments on commit 6dc7a5d

Please sign in to comment.