-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement transit instead of ad-hoc fades and improve singleton usage
- Loading branch information
1 parent
86efc76
commit 0f3fc12
Showing
22 changed files
with
121 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,7 @@ | ||
extends Control | ||
|
||
onready var _tween: Tween = $Tween | ||
onready var _blackout: ColorRect = $Blackout | ||
|
||
func _on_RichTextLabel_meta_clicked(meta: String): | ||
OS.shell_open(meta) | ||
|
||
func _on_MenuButton_pressed(): | ||
focus_mode = Control.FOCUS_NONE | ||
_blackout.visible = true | ||
_tween.interpolate_property( | ||
_blackout, | ||
"color:a", | ||
0, | ||
1, | ||
3, | ||
Tween.TRANS_LINEAR, | ||
Tween.EASE_IN | ||
) | ||
_tween.start() | ||
yield(_tween, "tween_all_completed") | ||
|
||
var err := get_tree().change_scene("res://states/Menu.tscn") | ||
if err: | ||
push_error("failed to change to menu scene: %s" % err) | ||
Transit.change_scene("res://states/Menu.tscn", 1.0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,12 @@ | ||
extends Control | ||
|
||
onready var _tween: Tween = $Tween | ||
|
||
func _fade_to_scene(path: String): | ||
focus_mode = Control.FOCUS_NONE | ||
|
||
$Blackout.visible = true | ||
|
||
var _r := _tween.interpolate_property( | ||
$Blackout, | ||
"color:a", | ||
0, | ||
1, | ||
0.5, | ||
Tween.TRANS_LINEAR, | ||
Tween.EASE_OUT | ||
) | ||
|
||
_r = _tween.start() | ||
yield(_tween, "tween_all_completed") | ||
var err := get_tree().change_scene(path) | ||
if err: | ||
push_error("failed to change scene to %s: %s" % [path, err]) | ||
|
||
func retry(): | ||
_fade_to_scene("res://states/Game.tscn") | ||
Transit.change_scene("res://states/Game.tscn", 1.0) | ||
|
||
func menu(): | ||
_fade_to_scene("res://states/Menu.tscn") | ||
Transit.change_scene("res://states/Menu.tscn", 1.0) | ||
|
||
func _ready(): | ||
var scores: ScoreTracker = get_node("/root/ScoreTracker") | ||
$ControlsBox/ScrapEarned.text = "You earned %s Scrap" % scores.get_scrap_earned() | ||
$ControlsBox/MobsKilled.text = "You killed %s drones" % scores.get_mobs_killed() | ||
$ControlsBox/Score.text = "Score: %s" % scores.calculate_score() | ||
$ControlsBox/ScrapEarned.text = "You earned %s Scrap" % ScoreTracker.get_scrap_earned() | ||
$ControlsBox/MobsKilled.text = "You killed %s drones" % ScoreTracker.get_mobs_killed() | ||
$ControlsBox/Score.text = "Score: %s" % ScoreTracker.calculate_score() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,10 @@ | ||
extends Control | ||
|
||
onready var _tween := $Tween | ||
|
||
func fade_to_scene(path: String): | ||
focus_mode = Control.FOCUS_NONE | ||
|
||
$Blackout.visible = true | ||
|
||
_tween.interpolate_property( | ||
$Blackout, | ||
"color:a", | ||
0, | ||
1, | ||
0.5, | ||
Tween.TRANS_LINEAR, | ||
Tween.EASE_OUT | ||
) | ||
|
||
_tween.interpolate_property( | ||
$AudioStreamPlayer, | ||
"volume_db", | ||
0, | ||
-80, | ||
0.5, | ||
Tween.TRANS_LINEAR, | ||
Tween.EASE_IN | ||
) | ||
|
||
_tween.start() | ||
yield(_tween, "tween_all_completed") | ||
var err = get_tree().change_scene(path) | ||
if err: | ||
push_error("failed to load scene %s: %s" % [path, err]) | ||
|
||
func start_game(): | ||
fade_to_scene("res://states/Game.tscn") | ||
Transit.change_scene("res://states/Game.tscn", 1.0) | ||
|
||
func about(): | ||
fade_to_scene("res://states/About.tscn") | ||
Transit.change_scene("res://states/About.tscn") | ||
|
||
func quit_game(): | ||
get_tree().quit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.