feat: Add shop screen (WIP)
This commit is contained in:
parent
bb564d639e
commit
23ff7358b4
15
player.gd
15
player.gd
|
|
@ -20,7 +20,10 @@ var is_active: bool = true
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
$Upgrades.update()
|
$Upgrades.update()
|
||||||
|
$Shop.upgrade_node = $Upgrades
|
||||||
|
$Shop.populate()
|
||||||
|
|
||||||
|
$Shop.visible = false
|
||||||
$FailControl.visible = false
|
$FailControl.visible = false
|
||||||
$FinishControl.visible = false
|
$FinishControl.visible = false
|
||||||
is_active = true
|
is_active = true
|
||||||
|
|
@ -91,9 +94,11 @@ func _on_retry_button_pressed():
|
||||||
|
|
||||||
|
|
||||||
func _on_continue_button_pressed():
|
func _on_continue_button_pressed():
|
||||||
stage_counter += 1
|
|
||||||
station_reached.emit()
|
|
||||||
$TimeLimit.start()
|
|
||||||
$FinishControl.visible = false
|
$FinishControl.visible = false
|
||||||
$HUD.visible = true
|
$Shop.visible = true
|
||||||
stamina = max_stamina
|
|
||||||
|
#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"]
|
[gd_scene format=3 uid="uid://cmb3b7xrlboy3"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://bobw4cfg1v6gj" path="res://player.gd" id="1_4flbx"]
|
[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"]
|
[ext_resource type="PackedScene" uid="uid://ct7cc7qg3hpu1" path="res://upgrades.tscn" id="2_onrkg"]
|
||||||
|
|
||||||
[sub_resource type="PlaneMesh" id="PlaneMesh_sh265"]
|
[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
|
wait_time = 60.0
|
||||||
one_shot = true
|
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]
|
[node name="FinishControl" type="Control" parent="." unique_id=1717901238]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
anchors_preset = 15
|
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 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.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func update() -> void:
|
func update() -> void:
|
||||||
if enabled:
|
if enabled:
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ extends Node
|
||||||
|
|
||||||
var parent: CharacterBody3D
|
var parent: CharacterBody3D
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
assert(get_parent().name == "Player", "Upgrade must have player as parent")
|
assert(get_parent().name == "Player", "Upgrade must have player as parent")
|
||||||
|
|
@ -17,3 +19,9 @@ func update() -> void:
|
||||||
for upgrade in upgrades:
|
for upgrade in upgrades:
|
||||||
upgrade.update()
|
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