New sfx, credits overhaul, and feedback button

This commit is contained in:
2020-05-17 17:07:52 -04:00
parent 3614049c11
commit e22d56d0df
23 changed files with 388 additions and 6 deletions

View File

@ -2,11 +2,63 @@ extends Control
const SCROLL_SPEED = 25
var scroll_timer : Timer
const SCROLL_TIP_DELAY = 5
const SCROLL_FADE_RATE = 0.05
const SCROLL_SHOW_RATE = 5
func _ready():
$"/root/MusicManager".play_music("Dystopian/The Story Continues")
$"/root/MusicManager".play_music("Dystopian/The Story Continues", false)
if not scroll_timer:
scroll_timer = Timer.new()
add_child(scroll_timer)
$Tip.modulate.a = 0
scroll_timer.connect("timeout", self, "display_tip")
scroll_timer.start(SCROLL_TIP_DELAY)
set_completed()
func _process(delta):
$Scolling.rect_position.y = $Scolling.rect_position.y - delta * SCROLL_SPEED
if Input.is_action_pressed("ui_accept"):
$Scolling.rect_position.y = $Scolling.rect_position.y - delta * SCROLL_SPEED * 10
else:
$Scolling.rect_position.y = $Scolling.rect_position.y - delta * SCROLL_SPEED
if abs($Scolling.rect_position.y) > $Scolling.rect_size.y + 100:
get_tree().change_scene("res://Scenes/Title.scn")
func display_tip():
$Tip.modulate.a = 0
$Tip.text = "Press SPACE to speed up."
$Tip.show()
scroll_timer.disconnect("timeout", self, "display_tip")
scroll_timer.disconnect("timeout", self, "fade_tip_out")
scroll_timer.disconnect("timeout", self, "start_fade_tip_out")
scroll_timer.connect("timeout", self, "fade_tip_in")
scroll_timer.start(SCROLL_FADE_RATE)
func start_fade_tip_out():
scroll_timer.disconnect("timeout", self, "display_tip")
scroll_timer.disconnect("timeout", self, "fade_tip_in")
scroll_timer.disconnect("timeout", self, "start_fade_tip_out")
scroll_timer.connect("timeout", self, "fade_tip_out")
scroll_timer.start(SCROLL_FADE_RATE)
func fade_tip_in():
$Tip.modulate.a = clamp($Tip.modulate.a + 0.1, 0, 1)
if $Tip.modulate.a == 1:
scroll_timer.disconnect("timeout", self, "display_tip")
scroll_timer.disconnect("timeout", self, "fade_tip_out")
scroll_timer.disconnect("timeout", self, "fade_tip_in")
scroll_timer.connect("timeout", self, "start_fade_tip_out")
scroll_timer.start(SCROLL_SHOW_RATE)
func fade_tip_out():
$Tip.modulate.a = clamp($Tip.modulate.a - 0.1, 0, 1)
if $Tip.modulate.a == 0:
scroll_timer.stop()
func set_completed():
var file = File.new()
file.open("user://progress.json", File.WRITE)
file.store_string(to_json({"completed":"true"}))
file.close()

View File

@ -10,8 +10,8 @@ func _ready():
audio_player = AudioStreamPlayer.new()
add_child(audio_player)
$Fader/ColorRect.show()
play_sound(preload("res://Assets/Sfx/intro/processed.wav"))
play_sound(preload("res://Assets/Sfx/intro/doop.wav"))
func play_sound(audio_stream):
audio_player.stream = audio_stream
#audio_player.play()
audio_player.play()

View File

@ -14,6 +14,7 @@ func _ready():
$CreditsButton.connect("button_down", self, "_on_button_press", ["credits"])
$OptionsButton.connect("button_down", self, "_on_button_press", ["options"])
$BugButton.connect("button_down", self, "_on_button_press", ["bug"])
check_completion()
func _on_button_press(button):
@ -29,3 +30,20 @@ func _on_button_press(button):
get_parent().get_parent().get_node("OptionsDialog").popup_centered()
"bug":
OS.shell_open("https://github.com/josephbmanley/the-connection/issues/new?labels=bug&template=1_bug_report.md")
"feedback":
OS.shell_open("https://cloudsumu.com/r/confeedback")
func check_completion():
var file = File.new()
if file.file_exists("user://progress.json"):
file.open("user://progress.json", File.READ)
var data = parse_json(file.get_as_text())
file.close()
if typeof(data) == TYPE_DICTIONARY:
if "completed" in data:
if data["completed"] == "true":
var feed_back_button = Button.new()
feed_back_button.text = "Give Feedback"
feed_back_button.connect("button_down", self, "_on_button_press", ["feedback"])
add_child(feed_back_button)
move_child(feed_back_button, 3)