Voice-acted tutorial

This commit is contained in:
Paul Black 2023-03-19 13:56:40 -06:00
parent 53a76142e8
commit 09520f64d9
12 changed files with 152 additions and 4 deletions

View file

@ -22,6 +22,8 @@ func _process(delta):
$Health.value = Global.playerHealth $Health.value = Global.playerHealth
if Global.mapName == "Tutorial": if Global.mapName == "Tutorial":
tutorial() tutorial()
if not Global.tutorialComplete:
$musicPanel.visible = false
if Global.iAmRunner: if Global.iAmRunner:
rpc("sync_runner_hp", $Health.value) rpc("sync_runner_hp", $Health.value)
if Global.musicUpdated == true: if Global.musicUpdated == true:
@ -134,6 +136,9 @@ func killed_text(killer, killed):
### TUTORIAL STUFF ### ### TUTORIAL STUFF ###
var audio_stream_player = AudioStreamPlayer.new()
var w = false var w = false
var a = false var a = false
var s = false var s = false
@ -167,6 +172,7 @@ func tutorial():
$TutorialPanel/Wasd.visible = true $TutorialPanel/Wasd.visible = true
$player1Label.text = Global.playerName $player1Label.text = Global.playerName
Global.HUDStartLabelText = " " Global.HUDStartLabelText = " "
play_audio(load("res://voice/tutorial/tutorial_1.mp3"))
if not w: if not w:
if Input.is_action_just_pressed("player_forward"): if Input.is_action_just_pressed("player_forward"):
w = true w = true
@ -216,13 +222,12 @@ func tutorial_2():
$TutorialPanel/Arrow_left.visible = true $TutorialPanel/Arrow_left.visible = true
$TutorialPanel/Arrow_down.visible = true $TutorialPanel/Arrow_down.visible = true
$TutorialPanel/Arrow_right.visible = true $TutorialPanel/Arrow_right.visible = true
play_audio(load("res://voice/tutorial/tutorial_2.mp3"))
if not ran_timer2: if not ran_timer2:
await get_tree().create_timer(0.5).timeout await get_tree().create_timer(0.5).timeout
ran_timer2 = true ran_timer2 = true
else: else:
var cam_rot = get_node(str(Global.selfTeddy) + '/CollisionShape3D/Neck/Camera3D').global_rotation var cam_rot = get_node(str(Global.selfTeddy) + '/CollisionShape3D/Neck/Camera3D').global_rotation
print("prev_cam_rot: ", prev_cam_rot)
print("cam_rot: ", cam_rot)
if not up: if not up:
if cam_rot.x > prev_cam_rot.x: if cam_rot.x > prev_cam_rot.x:
up = true up = true
@ -268,6 +273,7 @@ func tutorial_3():
$TutorialPanel/enter.visible = true $TutorialPanel/enter.visible = true
$TutorialPanel/EnterKey.visible = true $TutorialPanel/EnterKey.visible = true
Global.HUDStartLabelText = "PRESS ENTER/RETURN TO START THE ROUND" Global.HUDStartLabelText = "PRESS ENTER/RETURN TO START THE ROUND"
play_audio(load("res://voice/tutorial/tutorial_3.mp3"))
if Input.is_action_just_pressed("start_game"): if Input.is_action_just_pressed("start_game"):
stage3_continue = true stage3_continue = true
$player2Label.text = "AI" $player2Label.text = "AI"
@ -286,6 +292,7 @@ func tutorial_4():
$TutorialPanel/shoot.visible = true $TutorialPanel/shoot.visible = true
$TutorialPanel/Leftmouse.visible = true $TutorialPanel/Leftmouse.visible = true
play_audio(load("res://voice/tutorial/tutorial_4.mp3"))
if Input.is_action_just_pressed("shoot"): if Input.is_action_just_pressed("shoot"):
stage4_continue = true stage4_continue = true
if stage4_continue: if stage4_continue:
@ -304,6 +311,12 @@ func tutorial_5():
$TutorialPanel/timer.visible = true $TutorialPanel/timer.visible = true
$TutorialPanel/zero.visible = true $TutorialPanel/zero.visible = true
$TutorialPanel/done.visible = true $TutorialPanel/done.visible = true
await get_tree().create_timer(12).timeout play_audio(load("res://voice/tutorial/tutorial_5.mp3"))
await get_tree().create_timer(14).timeout
$TutorialPanel.visible = false $TutorialPanel.visible = false
Global.tutorialComplete = true Global.tutorialComplete = true
func play_audio(audio):
audio_stream_player.set_stream(audio)
add_child(audio_stream_player)
audio_stream_player.play()

View file

@ -1,5 +1,6 @@
extends Node extends Node
var audio_stream_player = AudioStreamPlayer.new()
func _ready(): func _ready():
Global.playerHealth = 100 Global.playerHealth = 100
@ -8,4 +9,43 @@ func _ready():
func _process(delta): func _process(delta):
pass if Global.tutorialComplete:
if audio_stream_player.playing == false:
var randomnum = RandomNumberGenerator.new().randi_range(0, 6)
if randomnum == 0:
play_music(load("res://music/alexander-nakarada-chase.mp3"))
Global.musicName = "Chase"
Global.musicAuthor = "Alexander Nakarada"
elif randomnum == 1:
play_music(load("res://music/DRIVE.mp3"))
Global.musicName = "DRIVE"
Global.musicAuthor = "Alex-Productions"
elif randomnum == 2:
play_music(load("res://music/Fluffing-a-Duck.mp3"))
Global.musicName = "Fluffing a Duck"
Global.musicAuthor = "Kevin MacLeod"
elif randomnum == 3:
play_music(load("res://music/Monkeys-Spinning-Monkeys.mp3"))
Global.musicName = "Monkeys Spinning Monkeys"
Global.musicAuthor = "Kevin MacLeod"
elif randomnum == 4:
play_music(load("res://music/Run-Amok.mp3"))
Global.musicName = "Run Amok"
Global.musicAuthor = "Kevin MacLeod"
elif randomnum == 5:
play_music(load("res://music/Sneaky-Snitch.mp3"))
Global.musicName = "Sneaky Snitch"
Global.musicAuthor = "Kevin MacLeod"
elif randomnum == 6:
play_music(load("res://music/Wallpaper.mp3"))
Global.musicName = "Wallpaper"
Global.musicAuthor = "Kevin MacLeod"
else:
print("This shouldn't ever be called, toyland.gd")
Global.musicUpdated = true
func play_music(music):
audio_stream_player.set_stream(music)
add_child(audio_stream_player)
audio_stream_player.play()

Binary file not shown.

View file

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://ct8eskbm7u6xo"
path="res://.godot/imported/tutorial_1.mp3-83ffcefda278b825aa9b651e210a1573.mp3str"
[deps]
source_file="res://voice/tutorial/tutorial_1.mp3"
dest_files=["res://.godot/imported/tutorial_1.mp3-83ffcefda278b825aa9b651e210a1573.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View file

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://cdpppk17gtm51"
path="res://.godot/imported/tutorial_2.mp3-82a51e419c2b1c14e3dab187140ce77c.mp3str"
[deps]
source_file="res://voice/tutorial/tutorial_2.mp3"
dest_files=["res://.godot/imported/tutorial_2.mp3-82a51e419c2b1c14e3dab187140ce77c.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View file

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://bt8eoj7jfxy7d"
path="res://.godot/imported/tutorial_3.mp3-3ccf7c76c582f24d98f7569bc09702d2.mp3str"
[deps]
source_file="res://voice/tutorial/tutorial_3.mp3"
dest_files=["res://.godot/imported/tutorial_3.mp3-3ccf7c76c582f24d98f7569bc09702d2.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View file

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://dvlxgofkwa2ag"
path="res://.godot/imported/tutorial_4.mp3-a1e05f7544b170e68386fe7e5f1e4e1c.mp3str"
[deps]
source_file="res://voice/tutorial/tutorial_4.mp3"
dest_files=["res://.godot/imported/tutorial_4.mp3-a1e05f7544b170e68386fe7e5f1e4e1c.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View file

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://cs1tffhk6e211"
path="res://.godot/imported/tutorial_5.mp3-9dbd4051471e17c9f452e062d61e8a48.mp3str"
[deps]
source_file="res://voice/tutorial/tutorial_5.mp3"
dest_files=["res://.godot/imported/tutorial_5.mp3-9dbd4051471e17c9f452e062d61e8a48.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4