-
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.
Merge branch 'programming' into main
- Loading branch information
Showing
13 changed files
with
251 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,31 @@ | ||
#class_name GameStateManager | ||
extends Node | ||
|
||
var game_seed : int = 0 | ||
var current_game_zones : Array[PackageZone] | ||
|
||
func _input(event): | ||
var just_pressed = event.is_pressed() and not event.is_echo() | ||
if Input.is_key_pressed(KEY_P) and just_pressed: | ||
PackageZoneManager.reset() | ||
GameStopwatch.reset() | ||
get_tree().reload_current_scene() | ||
|
||
func start_game(zone_count, _seed = null): | ||
if not _seed: | ||
randomize() | ||
_seed = randi() | ||
game_seed = hash(_seed) | ||
current_game_zones = PackageZoneManager.generate_zone_list(zone_count) | ||
PackageZoneManager.set_active_zones(current_game_zones) | ||
|
||
func register_package_zone_completion(zone : PackageZone): | ||
pass | ||
print("Player reached '%s'." % [zone.zone_name]) | ||
zone.set_enabled(false) | ||
current_game_zones.erase(zone) | ||
if len(current_game_zones) == 0: | ||
end_game() | ||
|
||
func end_game(): | ||
GameStopwatch.stop() | ||
print("You win! Your time was: %s" % [GameStopwatch.time]) |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#class_name GameStopwatch | ||
extends Node | ||
|
||
var running : bool = false | ||
var time : float = 0.0 | ||
# Called when the node enters the scene tree for the first time. | ||
|
||
func reset(): | ||
time = 0.0 | ||
running = false | ||
|
||
func start(): | ||
running = true | ||
|
||
func stop(): | ||
running = false | ||
|
||
func _process(delta): | ||
if running: | ||
time += delta |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
extends Node3D | ||
|
||
func _ready(): | ||
GameStateManager.start_game(1, "TIKTOK2") |
Oops, something went wrong.