Merge remote-tracking branch 'refs/remotes/origin/main'

This commit is contained in:
Dendy 2026-03-06 10:27:45 +01:00
commit 7258ed90a7
9 changed files with 62 additions and 2 deletions

14
camera_zoom.gd Normal file
View File

@ -0,0 +1,14 @@
extends Node
var enabled: bool = false
var cost: int = 3
var upgrade_name: String = "Camera"
var upgrade_description: String = "Afegeix una camera especial"
var icon: Texture2D = preload("res://assets/Images/Xenia Drawing 6.svg")
func update() -> void:
if enabled:
Global.special_camera = true
else:
Global.special_camera = false

1
camera_zoom.gd.uid Normal file
View File

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

View File

@ -2,3 +2,4 @@ extends Node
var chunk_size: float = 150
var street_width: float = 40
var station_coords: Vector3 = Vector3.ZERO
var special_camera: bool = false

View File

@ -153,7 +153,16 @@ func initialize_world() -> void:
chunk.update()
func _process(delta: float) -> void:
if Global.special_camera:
$SubViewportContainer.visible = true
else:
$SubViewportContainer.visible = false
if not $Player.is_active:
return
@ -171,6 +180,7 @@ func _process(delta: float) -> void:
new_ped.position = ped_pos
func _on_player_station_reached():
$SubViewportContainer.visible = false
for n in $ChunkContainer.get_children():
$ChunkContainer.remove_child(n)
n.queue_free()

View File

@ -3,6 +3,7 @@
[ext_resource type="Script" uid="uid://dj0cgqed5n3ys" path="res://level.gd" id="1_0b4ue"]
[ext_resource type="PackedScene" uid="uid://cmb3b7xrlboy3" path="res://player.tscn" id="1_u52ul"]
[ext_resource type="Script" uid="uid://b5ebibi08tjvd" path="res://camera_3d.gd" id="2_vonw3"]
[ext_resource type="Script" uid="uid://oy8s25dl6g4a" path="res://special_camera.gd" id="4_0b4ue"]
[sub_resource type="Environment" id="Environment_vonw3"]
ambient_light_source = 2
@ -26,7 +27,7 @@ environment = SubResource("Environment_vonw3")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.8361101, 0)
[node name="Camera3D" type="Camera3D" parent="." unique_id=2083164402]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 73.98364, 0)
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 56.95375, 0)
current = true
fov = 55.0
script = ExtResource("2_vonw3")
@ -37,4 +38,21 @@ shadow_enabled = true
[node name="ChunkContainer" type="Node3D" parent="." unique_id=166513533]
[node name="SubViewportContainer" type="SubViewportContainer" parent="." unique_id=2002031723]
offset_top = 1.0
offset_right = 207.0
offset_bottom = 196.0
stretch = true
[node name="SubViewport" type="SubViewport" parent="SubViewportContainer" unique_id=1364308452]
handle_input_locally = false
size = Vector2i(207, 195)
render_target_update_mode = 4
[node name="SpecialCamera" type="Camera3D" parent="SubViewportContainer/SubViewport" unique_id=684008087]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 139.07289, 0)
current = true
fov = 55.0
script = ExtResource("4_0b4ue")
[connection signal="station_reached" from="Player" to="." method="_on_player_station_reached"]

View File

@ -20,6 +20,7 @@ func _on_area_entered(area: Area3D) -> void:
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_cumbd"]
transparency = 1
albedo_color = Color(0.98752075, 0.9222888, 0.91135114, 1)
albedo_texture = ExtResource("1_y24h4")
[sub_resource type="CylinderShape3D" id="CylinderShape3D_rqnpm"]

7
special_camera.gd Normal file
View File

@ -0,0 +1,7 @@
extends Camera3D
@onready var player: CharacterBody3D = $"../../../Player"
func _process(delta: float) -> void:
self.position.x = player.position.x
self.position.z = player.position.z

1
special_camera.gd.uid Normal file
View File

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

View File

@ -1,6 +1,7 @@
[gd_scene format=3 uid="uid://byv518wlck1t4"]
[ext_resource type="Script" uid="uid://bxvhar7bgeyau" path="res://special_upgrades.gd" id="1_76f4f"]
[ext_resource type="Script" uid="uid://dew108n0d84n1" path="res://camera_zoom.gd" id="2_wn1cs"]
[sub_resource type="GDScript" id="GDScript_8j6ry"]
script/source = "extends Node
@ -9,12 +10,15 @@ var enabled: bool = false
var cost: int = 3
var upgrade_name: String = \"Tamany bloc\"
var upgrade_description: String = \"Fa mes xicotet cada bloc\"
var icon: Texture2D = preload(\"res://assets/Images/tren.jpg\")
var icon: Texture2D = preload(\"res://assets/Images/Xenia Drawing 6.svg\")
func update() -> void:
if enabled:
print(\"Updating chunk size\")
Global.chunk_size = 120
else:
Global.chunk_size = 150
"
[node name="SpecialUpgrades" type="Node" unique_id=1238785974]
@ -22,3 +26,6 @@ script = ExtResource("1_76f4f")
[node name="ChunkSize" type="Node" parent="." unique_id=1030985851]
script = SubResource("GDScript_8j6ry")
[node name="CameraZoom" type="Node" parent="." unique_id=1211450879]
script = ExtResource("2_wn1cs")