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

This commit is contained in:
Dendy 2026-03-05 20:47:55 +01:00
commit dd351090a6
3 changed files with 110 additions and 31 deletions

View File

@ -10,10 +10,10 @@ const STAMINA_COST = 15
const STAMINA_RECOVER = 10
const SCORE_RANK = {
"C": { "time": 10, "money": 500, "color": Color.BROWN },
"B": { "time": 20, "money": 1000, "color": Color.PURPLE },
"A": { "time": 30, "money": 1500, "color": Color.GREEN },
"S": { "time": 999, "money": 2000, "color": Color.YELLOW },
"C": { "time": 10, "money": 500, "special": 0, "color": Color.BROWN },
"B": { "time": 20, "money": 1000, "special": 0, "color": Color.PURPLE },
"A": { "time": 30, "money": 1500, "special": 1, "color": Color.GREEN },
"S": { "time": 999, "money": 2000, "special": 1, "color": Color.YELLOW },
}
var pedestrian_area_count = 0
@ -90,6 +90,8 @@ func _on_area_area_entered(area: Area3D) -> void:
continue
$Shop.available_money += rank["money"]
$Shop.special_currency += rank["special"]
scoreLbl.text = letter
scoreLbl.add_theme_color_override("font_color", rank["color"])

27
shop.gd
View File

@ -1,18 +1,22 @@
extends Control
var upgrade_node: Node
var available_money: int = 30
var available_money: int = 0
var special_currency: int = 0
signal shop_exit
func _process(delta: float) -> void:
$Money.text = str(available_money)
$SpecialMoney.text = str(special_currency)
# Called when the node enters the scene tree for the first time.
func populate() -> void:
$TuxUpgrades.clear()
for upgrade in upgrade_node.get_children():
var index = $TuxUpgrades.add_item(upgrade.upgrade_description, upgrade.icon)
var index = $TuxUpgrades.add_item(upgrade.upgrade_description + " Cost: " + str(upgrade.cost), upgrade.icon)
$TuxUpgrades.set_item_metadata(index, upgrade)
if upgrade.enabled:
$TuxUpgrades.set_item_disabled(index, true)
@ -38,5 +42,22 @@ func _on_tux_upgrades_item_clicked(index: int, at_position: Vector2, mouse_butto
$Error.text = "No tens prou Diners!!!!"
func _on_button_pressed() -> void:
func _on_continue_pressed() -> void:
$Tux.visible = true
$Xenia.visible = true
$TuxUpgrades.visible = false
shop_exit.emit()
func _on_xenia_mouse_entered() -> void:
$Xenia.modulate = Color(0.5, 0.5, 0.6)
func _on_xenia_mouse_exited() -> void:
$Xenia.modulate = Color(1, 1, 1)
func _on_tux_pressed() -> void:
$Tux.visible = false
$Xenia.visible = false
$TuxUpgrades.visible = true

104
shop.tscn
View File

@ -3,6 +3,7 @@
[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"]
[ext_resource type="Texture2D" uid="uid://grccrvjhjo0f" path="res://assets/Images/Xenia Drawing 6.svg" id="4_fgaav"]
[node name="Shop" type="Control" unique_id=632945658]
layout_mode = 3
@ -13,7 +14,7 @@ grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_7ae35")
[node name="TextureRect" type="TextureRect" parent="." unique_id=1400016957]
[node name="Background" type="TextureRect" parent="." unique_id=1400016957]
modulate = Color(0.4156048, 0.3595127, 0.2152954, 1)
layout_mode = 1
anchors_preset = 8
@ -30,21 +31,40 @@ grow_vertical = 2
texture = ExtResource("2_c0ofq")
expand_mode = 5
[node name="Tux" type="TextureRect" parent="." unique_id=200750690]
[node name="Tux" type="Button" parent="." unique_id=444298433]
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
offset_left = -375.0
offset_top = -281.0
offset_right = -81.0
offset_bottom = -10.037109
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("2_f511j")
expand_mode = 3
scale = Vector2(1, 1.0799998)
icon = ExtResource("2_f511j")
icon_alignment = 1
expand_icon = true
[node name="Xenia" type="Button" parent="." unique_id=119483869]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = 128.0
offset_top = -281.0
offset_right = 472.0
offset_bottom = 30.0
grow_horizontal = 2
grow_vertical = 2
icon = ExtResource("4_fgaav")
icon_alignment = 1
expand_icon = true
[node name="TuxText" type="Label" parent="." unique_id=1682412623]
layout_mode = 1
@ -62,7 +82,24 @@ grow_vertical = 2
theme_override_font_sizes/font_size = 40
text = "Tenda de TUX"
[node name="XeniaText" type="Label" parent="." unique_id=369234782]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = 151.0
offset_top = 27.0
offset_right = 456.0
offset_bottom = 95.0
grow_horizontal = 2
grow_vertical = 2
theme_override_font_sizes/font_size = 40
text = "Tenda de XENIA"
[node name="TuxUpgrades" type="ItemList" parent="." unique_id=351105576]
visible = false
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
@ -77,20 +114,36 @@ grow_horizontal = 2
grow_vertical = 2
fixed_icon_size = Vector2i(100, 100)
[node name="Diners" type="Label" parent="." unique_id=1267923551]
[node name="Pessetes" type="Label" parent="." unique_id=1267923551]
layout_mode = 0
offset_left = 161.0
offset_top = 3.0
offset_right = 212.0
offset_bottom = 26.0
text = "Diners:"
offset_left = 205.0
offset_top = 16.0
offset_right = 277.0
offset_bottom = 39.0
text = "Pessetes:"
[node name="Money" type="Label" parent="." unique_id=234629460]
layout_mode = 0
offset_left = 223.0
offset_top = 4.0
offset_right = 263.0
offset_bottom = 27.0
offset_left = 290.0
offset_top = 17.0
offset_right = 330.0
offset_bottom = 40.0
text = "0"
[node name="Special" type="Label" parent="." unique_id=2132191088]
layout_mode = 0
offset_left = 708.0
offset_top = 12.0
offset_right = 748.0
offset_bottom = 35.0
text = "🥘:"
[node name="SpecialMoney" type="Label" parent="." unique_id=673378036]
layout_mode = 0
offset_left = 742.0
offset_top = 14.0
offset_right = 782.0
offset_bottom = 37.0
text = "0"
[node name="Description" type="Label" parent="." unique_id=1324515689]
@ -114,14 +167,14 @@ anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -136.0
offset_top = -309.0
offset_right = 132.0
offset_bottom = -270.0
offset_left = -88.0
offset_top = 93.0
offset_right = 180.0
offset_bottom = 132.0
grow_horizontal = 2
grow_vertical = 2
[node name="Button" type="Button" parent="." unique_id=1169928484]
[node name="Continue" type="Button" parent="." unique_id=1169928484]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
@ -139,5 +192,8 @@ text = "Continuar"
[connection signal="mouse_entered" from="Tux" to="." method="_on_tux_mouse_entered"]
[connection signal="mouse_exited" from="Tux" to="." method="_on_tux_mouse_exited"]
[connection signal="pressed" from="Tux" to="." method="_on_tux_pressed"]
[connection signal="mouse_entered" from="Xenia" to="." method="_on_xenia_mouse_entered"]
[connection signal="mouse_exited" from="Xenia" to="." method="_on_xenia_mouse_exited"]
[connection signal="item_clicked" from="TuxUpgrades" to="." method="_on_tux_upgrades_item_clicked"]
[connection signal="pressed" from="Button" to="." method="_on_button_pressed"]
[connection signal="pressed" from="Continue" to="." method="_on_continue_pressed"]