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 var index_integer = 0
@onready var GNN_lenght = get_node ("Label/GIN").get_total_character_count() @onready var GNN_lenght = get_node ("Label/GIN").get_total_character_count()
func _ready(): func _ready():
# teraz chowamy niepotrzebne teksty # teraz chowamy niepotrzebne teksty
$Label/Nazwa_statku.hide() $Label/Nazwa_statku.hide()
$Label/Nazwa_statku.visible_characters = 0 $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

View File

@@ -1,4 +1,4 @@
[gd_resource type="AudioBusLayout" format=3 uid="uid://clgkeb5hrksja"] [gd_resource type="AudioBusLayout" load_steps=0 format=3 uid="uid://clgkeb5hrksja"]
[resource] [resource]
bus/1/name = &"Music" bus/1/name = &"Music"

View File

@@ -1,4 +1,4 @@
[gd_scene format=3 uid="uid://db3qkr4k5gpbh"] [gd_scene load_steps=0 format=3 uid="uid://db3qkr4k5gpbh"]
[node name="Control" type="Control"] [node name="Control" type="Control"]
layout_mode = 3 layout_mode = 3

View File

@@ -17,6 +17,8 @@ config/icon="res://icon.svg"
[autoload] [autoload]
Settings="*res://Scripts/settings.gd"
CoreManager="*res://Scripts/core_manager.gd"
BackgroundMusic="*res://sceny/background_music.tscn" BackgroundMusic="*res://sceny/background_music.tscn"
[internationalization] [internationalization]