Core gry, settings

Dodanie skryptu settings i core_manager
Uruchomienie liczenia czasu w grze
This commit is contained in:
2025-10-23 16:23:12 +02:00
parent b7f0180a96
commit b52ef06af8
8 changed files with 40 additions and 3 deletions

30
Scripts/core_manager.gd Normal file
View File

@@ -0,0 +1,30 @@
extends Node
func _ready ():
start_build()
var game_time := 0.0 #aktualny czas w grze
var build_duration := 10.0
var finish_time := 0.0
var is_building := false
func _process(delta):
game_time += delta * Settings.time_scale
#print(now())
if is_building:
if game_time >= finish_time:
finish_building()
func now() -> float:
return game_time
func start_build():
# ustawiamy czas zakończenia budowy na current_time + build_duration
finish_time = game_time + build_duration
is_building = true
print("Budowa rozpoczęta. Zakończy się o czasie:", finish_time)
func finish_building():
is_building = false
print("Budowa zakończona w czasie gry:", game_time)

View File

@@ -0,0 +1 @@
uid://cfp08u5odbrej

View File

@@ -4,7 +4,6 @@ var index : float = 0
var index_integer = 0
@onready var GNN_lenght = get_node ("Label/GIN").get_total_character_count()
func _ready():
# teraz chowamy niepotrzebne teksty
$Label/Nazwa_statku.hide()
$Label/Nazwa_statku.visible_characters = 0

4
Scripts/settings.gd Normal file
View File

@@ -0,0 +1,4 @@
extends Node
#Opcje konfiguracyjne
var time_scale := 1 #mnożnik czasu (x1 normalny)

1
Scripts/settings.gd.uid Normal file
View File

@@ -0,0 +1 @@
uid://45qg56i64o8p