Merge remote-tracking branch 'refs/remotes/origin/main'
This commit is contained in:
commit
e9b78f49e2
2
chunk.gd
2
chunk.gd
|
|
@ -3,7 +3,7 @@ extends Node3D
|
|||
|
||||
var exits: Array = [false, false, false, false]
|
||||
|
||||
const STREET_WIDTH: float = 80
|
||||
const STREET_WIDTH: float = 40
|
||||
@onready var exit_area = $BuildingAreas/B_area_E/Collision
|
||||
@onready var building_area = $BuildingAreas/B_area/Collision
|
||||
|
||||
|
|
|
|||
4
level.gd
4
level.gd
|
|
@ -125,6 +125,9 @@ func initialize_world() -> void:
|
|||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if not $Player.is_active:
|
||||
return
|
||||
|
||||
var spawn_radius = $Player/SpawnArea/Collision.shape.radius + randf_range(-5, 5)
|
||||
var rand_unit_vec = Vector3.RIGHT.rotated(Vector3.UP, randf() * TAU)
|
||||
var ped_pos = $Player.position + rand_unit_vec * spawn_radius
|
||||
|
|
@ -138,7 +141,6 @@ func _process(delta: float) -> void:
|
|||
add_child(new_ped)
|
||||
new_ped.position = ped_pos
|
||||
|
||||
|
||||
func _on_player_station_reached():
|
||||
for n in $ChunkContainer.get_children():
|
||||
$ChunkContainer.remove_child(n)
|
||||
|
|
|
|||
23
player.gd
23
player.gd
|
|
@ -23,17 +23,23 @@ var stamina: float = max_stamina
|
|||
|
||||
var stage_counter: int = 0
|
||||
|
||||
var is_active: bool = true
|
||||
|
||||
func _ready() -> void:
|
||||
$Upgrades.update()
|
||||
$Shop.upgrade_node = $Upgrades
|
||||
$Shop.populate()
|
||||
|
||||
$Shop.visible = false
|
||||
$FailControl.visible = false
|
||||
$FinishControl.visible = false
|
||||
is_active = true
|
||||
$HUD.visible = true
|
||||
$TimeLimit.start()
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
# On fail screen, ignore further input
|
||||
if $FailControl.visible or $FinishControl.visible:
|
||||
if not is_active:
|
||||
return
|
||||
|
||||
$HUD/StaminaRect.scale.x = stamina / max_stamina
|
||||
|
|
@ -79,6 +85,7 @@ func _on_area_area_entered(area: Area3D) -> void:
|
|||
break
|
||||
|
||||
$TimeLimit.stop()
|
||||
is_active = false
|
||||
|
||||
func _on_area_area_exited(area: Area3D) -> void:
|
||||
if area.name == "PedestrianArea":
|
||||
|
|
@ -87,6 +94,7 @@ func _on_area_area_exited(area: Area3D) -> void:
|
|||
|
||||
|
||||
func _on_time_limit_timeout():
|
||||
is_active = false
|
||||
$FailControl.visible = true
|
||||
$HUD.visible = false
|
||||
|
||||
|
|
@ -96,14 +104,17 @@ func _on_retry_button_pressed():
|
|||
$FailControl.visible = false
|
||||
$HUD.visible = true
|
||||
station_reached.emit()
|
||||
is_active = true
|
||||
$TimeLimit.start()
|
||||
stamina = max_stamina
|
||||
|
||||
|
||||
func _on_continue_button_pressed():
|
||||
stage_counter += 1
|
||||
station_reached.emit()
|
||||
$TimeLimit.start()
|
||||
$FinishControl.visible = false
|
||||
$HUD.visible = true
|
||||
stamina = max_stamina
|
||||
$Shop.visible = true
|
||||
|
||||
#stage_counter += 1
|
||||
#station_reached.emit()
|
||||
#$TimeLimit.start()
|
||||
#$HUD.visible = true
|
||||
#stamina = max_stamina
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
[gd_scene format=3 uid="uid://cmb3b7xrlboy3"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bobw4cfg1v6gj" path="res://player.gd" id="1_4flbx"]
|
||||
[ext_resource type="PackedScene" uid="uid://52hoyqjot1cs" path="res://shop.tscn" id="2_i3pqv"]
|
||||
[ext_resource type="PackedScene" uid="uid://ct7cc7qg3hpu1" path="res://upgrades.tscn" id="2_onrkg"]
|
||||
|
||||
[sub_resource type="PlaneMesh" id="PlaneMesh_sh265"]
|
||||
|
|
@ -46,6 +47,9 @@ debug_color = Color(0.41852123, 0.4635067, 0.996484, 0.41960785)
|
|||
wait_time = 60.0
|
||||
one_shot = true
|
||||
|
||||
[node name="Shop" parent="." unique_id=632945658 instance=ExtResource("2_i3pqv")]
|
||||
visible = false
|
||||
|
||||
[node name="FinishControl" type="Control" parent="." unique_id=1717901238]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
extends Control
|
||||
|
||||
var upgrade_node: Node
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func populate() -> void:
|
||||
for upgrade in upgrade_node.get_children():
|
||||
$TuxUpgrades.add_item(upgrade.upgrade_name, upgrade.icon)
|
||||
|
||||
|
||||
func _on_tux_mouse_entered() -> void:
|
||||
$Tux.modulate = Color(0.5, 0.5, 0.6)
|
||||
|
||||
|
||||
func _on_tux_mouse_exited() -> void:
|
||||
$Tux.modulate = Color(1, 1, 1)
|
||||
|
|
@ -0,0 +1 @@
|
|||
uid://bwekjlqnn55ea
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
[gd_scene format=3 uid="uid://52hoyqjot1cs"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bwekjlqnn55ea" path="res://shop.gd" id="1_7ae35"]
|
||||
[ext_resource type="Texture2D" uid="uid://vafsec00vepj" path="res://assets/Images/tren.jpg" id="2_c0ofq"]
|
||||
[ext_resource type="Texture2D" uid="uid://ci36unhukt8tl" path="res://assets/Images/penguin21.webp" id="2_f511j"]
|
||||
|
||||
[node name="Shop" type="Control" unique_id=632945658]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_7ae35")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="." unique_id=1400016957]
|
||||
modulate = Color(0.4156048, 0.3595127, 0.2152954, 1)
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -577.0
|
||||
offset_top = -432.70294
|
||||
offset_right = 577.0
|
||||
offset_bottom = 432.70294
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("2_c0ofq")
|
||||
expand_mode = 5
|
||||
|
||||
[node name="Tux" type="TextureRect" parent="." unique_id=200750690]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -431.0
|
||||
offset_top = -268.0
|
||||
offset_right = -87.0
|
||||
offset_bottom = 43.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("2_f511j")
|
||||
expand_mode = 3
|
||||
|
||||
[node name="TuxText" type="Label" parent="." unique_id=1682412623]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -368.0
|
||||
offset_top = 25.0
|
||||
offset_right = -103.0
|
||||
offset_bottom = 93.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_font_sizes/font_size = 40
|
||||
text = "Tenda de TUX"
|
||||
|
||||
[node name="TuxUpgrades" type="ItemList" parent="." unique_id=351105576]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -415.0
|
||||
offset_top = -295.0
|
||||
offset_right = -32.0
|
||||
offset_bottom = 288.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
fixed_icon_size = Vector2i(100, 100)
|
||||
|
||||
[connection signal="mouse_entered" from="Tux" to="." method="_on_tux_mouse_entered"]
|
||||
[connection signal="mouse_exited" from="Tux" to="." method="_on_tux_mouse_exited"]
|
||||
|
|
@ -2,6 +2,11 @@ extends Node
|
|||
|
||||
var enabled: bool = true
|
||||
|
||||
var upgrade_name: String = "Energia"
|
||||
var upgrade_Description: String = "Multiplicar energia per 2"
|
||||
var icon: Texture2D = preload("res://assets/Images/tren.jpg")
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func update() -> void:
|
||||
if enabled:
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ extends Node
|
|||
|
||||
var parent: CharacterBody3D
|
||||
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
assert(get_parent().name == "Player", "Upgrade must have player as parent")
|
||||
|
|
@ -17,3 +19,9 @@ func update() -> void:
|
|||
for upgrade in upgrades:
|
||||
upgrade.update()
|
||||
|
||||
|
||||
func reset():
|
||||
var upgrades: Array = get_children()
|
||||
print("Updating all upgrades...")
|
||||
for upgrade in upgrades:
|
||||
upgrade.enabled = false
|
||||
|
|
|
|||
Loading…
Reference in New Issue