feat: implement TowerResource

This commit is contained in:
Varylios 2025-08-29 20:07:36 +02:00
parent 5ffb0e7431
commit a2213dcce5
20 changed files with 156 additions and 654 deletions

View file

@ -3,7 +3,7 @@ extends Node
#Emitter : TowerButton.gd #Emitter : TowerButton.gd
#Subscriber : World.gd #Subscriber : World.gd
signal tower_selected(tower : PackedScene) signal tower_selected(towerType : Tower.TYPES)
#Emitter : #Emitter :
@ -59,7 +59,7 @@ signal money_spent(_value : int)
#Subscriber : cube.gd #Subscriber : cube.gd
signal player_has_won() signal player_has_won()
#Emitter : spawner.gd #Emitter : WaveManger.gd
#Subscriber : cube.gd #Subscriber : cube.gd
signal player_defeated() signal player_defeated()

View file

@ -1,6 +1,8 @@
extends Node3D extends Node3D
class_name PlayerManager class_name PlayerManager
const towerListResource := preload("res://Towers/towers.tres")
enum STATE { IDLE, PLACING } enum STATE { IDLE, PLACING }
var _state := STATE.IDLE var _state := STATE.IDLE
@ -12,15 +14,8 @@ var selected_tower_type : Tower.TYPES = Tower.TYPES.NONE
@onready var selection_icon : Sprite3D = $Sprite3DSelection @onready var selection_icon : Sprite3D = $Sprite3DSelection
var towers : Dictionary var towers : Dictionary
var selected_collider : CollisionObject3D var selected_collider : CollisionObject3D
static func getResourceTowerByType(towerId : Tower.TYPES) -> PackedScene:
match towerId:
Tower.TYPES.PIERRE: return load("res://Towers/Pierre/pierre.tscn")
Tower.TYPES.ALINE: return load("res://Towers/Aline/aline.tscn")
_: return null
func _ready() -> void: func _ready() -> void:
EventBus.tower_selected.connect(selectTower) EventBus.tower_selected.connect(selectTower)
#$AnimationPlayer.play("arrow_bobbing") #$AnimationPlayer.play("arrow_bobbing")
@ -79,13 +74,7 @@ func handle_player_controls() -> void:
func place_tower() -> void: func place_tower() -> void:
_state = STATE.PLACING _state = STATE.PLACING
var towerBlueprint = getResourceTowerByType(selected_tower_type) selected_tower = towerListResource.getTowerSceneById(selected_tower_type).instantiate()
if !towerBlueprint:
selected_tower = null
selected_tower_type = Tower.TYPES.NONE
return
selected_tower = towerBlueprint.instantiate()
towers.set(selected_tower_type, selected_tower) towers.set(selected_tower_type, selected_tower)
add_child(selected_tower) add_child(selected_tower)
selected_tower.can_shoot = false selected_tower.can_shoot = false

View file

@ -1,14 +1,15 @@
[gd_scene load_steps=4 format=3 uid="uid://ck1qryleu80s"] [gd_scene load_steps=5 format=3 uid="uid://ck1qryleu80s"]
[ext_resource type="PackedScene" uid="uid://trg7ag3dqr2l" path="res://Towers/tower.tscn" id="1_gvvig"] [ext_resource type="PackedScene" uid="uid://trg7ag3dqr2l" path="res://Towers/tower.tscn" id="1_gvvig"]
[ext_resource type="Script" uid="uid://16hafh01iv" path="res://Towers/Aline/aline.gd" id="2_6sjqq"] [ext_resource type="Script" uid="uid://16hafh01iv" path="res://Towers/Aline/aline.gd" id="2_6sjqq"]
[ext_resource type="Texture2D" uid="uid://cob1lydkirn20" path="res://Assets/Icones/raccoon-head.svg" id="3_6h033"]
[ext_resource type="Script" uid="uid://bg0x4egeu17qb" path="res://Scripts/Upgrades/TowerUpgrade.gd" id="3_p2nb1"] [ext_resource type="Script" uid="uid://bg0x4egeu17qb" path="res://Scripts/Upgrades/TowerUpgrade.gd" id="3_p2nb1"]
[node name="Aline" instance=ExtResource("1_gvvig")] [node name="Aline" instance=ExtResource("1_gvvig")]
script = ExtResource("2_6sjqq") script = ExtResource("2_6sjqq")
tower_name = "Aline" tower_name = "Aline"
tower_type = 2 tower_type = 2
icone = null icone = ExtResource("3_6h033")
bio = "" bio = ""
price = 150 price = 150
bullet_damage = 1 bullet_damage = 1

View file

@ -2,12 +2,19 @@
[ext_resource type="PackedScene" uid="uid://trg7ag3dqr2l" path="res://Towers/tower.tscn" id="1_7f7qx"] [ext_resource type="PackedScene" uid="uid://trg7ag3dqr2l" path="res://Towers/tower.tscn" id="1_7f7qx"]
[ext_resource type="Script" uid="uid://q4o384wv3ijj" path="res://Towers/Pierre/pierre.gd" id="1_v16mf"] [ext_resource type="Script" uid="uid://q4o384wv3ijj" path="res://Towers/Pierre/pierre.gd" id="1_v16mf"]
[ext_resource type="Script" uid="uid://bg0x4egeu17qb" path="res://Scripts/Upgrades/TowerUpgrade.gd" id="3_v16mf"] [ext_resource type="Texture2D" uid="uid://bb4wihq1n1wm7" path="res://Assets/Icones/labrador-head.svg" id="3_odfqx"]
[node name="Pierre" instance=ExtResource("1_7f7qx")] [node name="Pierre" instance=ExtResource("1_7f7qx")]
script = ExtResource("1_v16mf") script = ExtResource("1_v16mf")
tower_name = null
tower_type = 1 tower_type = 1
icone = null icone = ExtResource("3_odfqx")
bio = "" bio = null
bullet_damage = 1 price = null
tower_shop = Array[ExtResource("3_v16mf")]([]) bullet_damage = null
action_cooldown = null
max_energy = null
energy_regen = null
energy_cost = null
buttonTooltip = null
tower_shop = null

View file

@ -0,0 +1,23 @@
@tool
extends Resource
class_name TowerListResource
@export var towers : Array[TowerResource] : set = towersHasChanged
func getTowerSceneById(towerType : Tower.TYPES) -> PackedScene :
var towerIndex := towers.find_custom(func(towerResource): return towerResource.towerType == towerType)
return towers[towerIndex].towerScene
func towersHasChanged(value : Array) -> void:
if not Engine.is_editor_hint():
return
if value.back() == null:
value.pop_back()
value.append(TowerResource.new())
towers = value
for towerResource in towers:
if not towerResource.changed.is_connected(emit_changed):
towerResource.changed.connect(emit_changed)
emit_changed()

View file

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

14
Towers/TowerResource.gd Normal file
View file

@ -0,0 +1,14 @@
@tool
extends Resource
class_name TowerResource
@export var towerScene : PackedScene : set = towerSceneHasChanged
var towerType : Tower.TYPES
func towerSceneHasChanged(value) -> void :
towerScene = value
if value:
var tower : Tower = towerScene.instantiate()
towerType = tower.tower_type
tower.queue_free()
emit_changed()

View file

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

View file

@ -24,6 +24,11 @@ var bullet : PackedScene = preload("res://Bullets/bullet.tscn")
max_energy = value max_energy = value
@export var energy_regen : float = 10.0 @export var energy_regen : float = 10.0
@export var energy_cost : float = 50.0 @export var energy_cost : float = 50.0
@export_group("Button")
@export var buttonTooltip : String
@onready var energy_bar : EnergyBar3D = $EnergyBar3D @onready var energy_bar : EnergyBar3D = $EnergyBar3D
@onready var sprite : Sprite3D = $Sprite3D @onready var sprite : Sprite3D = $Sprite3D

20
Towers/towers.tres Normal file
View file

@ -0,0 +1,20 @@
[gd_resource type="Resource" script_class="TowerListResource" load_steps=7 format=3 uid="uid://jd8bdhpyl0pw"]
[ext_resource type="Script" uid="uid://clm4xbebbeqgj" path="res://Towers/TowerListResource.gd" id="1_yjmnm"]
[ext_resource type="Script" uid="uid://lvkeejppvv2c" path="res://Towers/TowerResource.gd" id="2_mwakf"]
[ext_resource type="PackedScene" uid="uid://bj6srer7ghf7p" path="res://Towers/Pierre/pierre.tscn" id="3_mwakf"]
[ext_resource type="PackedScene" uid="uid://ck1qryleu80s" path="res://Towers/Aline/aline.tscn" id="4_mwakf"]
[sub_resource type="Resource" id="Resource_mwakf"]
script = ExtResource("2_mwakf")
towerScene = ExtResource("3_mwakf")
metadata/_custom_type_script = "uid://lvkeejppvv2c"
[sub_resource type="Resource" id="Resource_dlgx8"]
script = ExtResource("2_mwakf")
towerScene = ExtResource("4_mwakf")
metadata/_custom_type_script = "uid://lvkeejppvv2c"
[resource]
script = ExtResource("1_yjmnm")
towers = Array[ExtResource("2_mwakf")]([SubResource("Resource_mwakf"), SubResource("Resource_dlgx8")])

View file

@ -1,9 +1,18 @@
@tool
extends Control extends Control
@onready var player_manager : PlayerManager = $"../../PlayerManager" const BUTTON_QTY = 12
const towerButton := preload("res://UI/tower_button.tscn")
var towerListResource := preload("res://Towers/towers.tres")
@onready var buttonContainer = $HBoxContainer/ControlPanelBase/MarginContainer/GridContainer
func _ready() -> void: func _ready() -> void:
pass addTowerButtonNodes()
if Engine.is_editor_hint():
towerListResource.changed.connect(addTowerButtonNodes)
func _on_button_cube_pressed() -> void: func _on_button_cube_pressed() -> void:
pass # Replace with function body. pass # Replace with function body.
@ -15,3 +24,27 @@ func _on_button_quit_level_pressed() -> void:
func _on_button_quit_game_pressed() -> void: func _on_button_quit_game_pressed() -> void:
get_tree().quit() get_tree().quit()
func addTowerButtonNodes() -> void:
for node in buttonContainer.get_children():
if node.has_meta("dynamicButton"):
node.queue_free()
for towerResource in towerListResource.towers:
if !towerResource || towerResource.towerType == Tower.TYPES.NONE:
continue
var towerBtn := towerButton.instantiate()
var tower : Tower = towerResource.towerScene.instantiate()
towerBtn.towerType = tower.tower_type
towerBtn.tooltip_text = tower.name
towerBtn.setButtonTexture(tower.icone)
towerBtn.set_meta("dynamicButton", true)
tower.queue_free()
buttonContainer.add_child(towerBtn)
for i in BUTTON_QTY - towerListResource.towers.size():
var placeholderBtn := Button.new()
placeholderBtn.set_meta("dynamicButton", true)
placeholderBtn.custom_minimum_size = Vector2(80, 80)
buttonContainer.add_child(placeholderBtn)

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=22 format=3 uid="uid://p6a6rb7sgeqd"] [gd_scene load_steps=15 format=3 uid="uid://p6a6rb7sgeqd"]
[ext_resource type="Script" uid="uid://d2x8oy4os7ysn" path="res://UI/label_money.gd" id="1_cwd3r"] [ext_resource type="Script" uid="uid://d2x8oy4os7ysn" path="res://UI/label_money.gd" id="1_cwd3r"]
[ext_resource type="Script" uid="uid://c350dletl5pde" path="res://UI/label_tower_in_cube.gd" id="2_6ujs1"] [ext_resource type="Script" uid="uid://c350dletl5pde" path="res://UI/label_tower_in_cube.gd" id="2_6ujs1"]
@ -9,14 +9,7 @@
[ext_resource type="Texture2D" uid="uid://csl43eb7qjhe4" path="res://Assets/Icones/dog-house.svg" id="7_fffne"] [ext_resource type="Texture2D" uid="uid://csl43eb7qjhe4" path="res://Assets/Icones/dog-house.svg" id="7_fffne"]
[ext_resource type="Texture2D" uid="uid://dfnf26suc8yb6" path="res://Assets/Icones/sideswipe.svg" id="8_ay13l"] [ext_resource type="Texture2D" uid="uid://dfnf26suc8yb6" path="res://Assets/Icones/sideswipe.svg" id="8_ay13l"]
[ext_resource type="Texture2D" uid="uid://dootdihg7gkoj" path="res://Assets/Icones/exit-door.svg" id="8_decjp"] [ext_resource type="Texture2D" uid="uid://dootdihg7gkoj" path="res://Assets/Icones/exit-door.svg" id="8_decjp"]
[ext_resource type="Texture2D" uid="uid://bb4wihq1n1wm7" path="res://Assets/Icones/labrador-head.svg" id="9_decjp"]
[ext_resource type="Texture2D" uid="uid://b4m5ejfdrm8s0" path="res://Assets/Icones/power-button.svg" id="9_reygo"] [ext_resource type="Texture2D" uid="uid://b4m5ejfdrm8s0" path="res://Assets/Icones/power-button.svg" id="9_reygo"]
[ext_resource type="Texture2D" uid="uid://cob1lydkirn20" path="res://Assets/Icones/raccoon-head.svg" id="10_reygo"]
[ext_resource type="Texture2D" uid="uid://boxdrq4nrq7hv" path="res://Assets/Icones/flamingo.svg" id="11_76b7g"]
[ext_resource type="PackedScene" uid="uid://dqb5o8w7u50hc" path="res://UI/tower_button-v2.tscn" id="11_ay13l"]
[ext_resource type="Texture2D" uid="uid://m6jwakrus50v" path="res://Assets/Icones/sea-star.svg" id="12_ih1k6"]
[ext_resource type="Texture2D" uid="uid://dwwgho6f8f4kj" path="res://Assets/Icones/penguin.svg" id="13_ryolu"]
[ext_resource type="Texture2D" uid="uid://c4ir6y45pchpl" path="res://Assets/Icones/seahorse.svg" id="14_hndjt"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_h4fn5"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_h4fn5"]
bg_color = Color(0.933333, 0.933333, 0.933333, 1) bg_color = Color(0.933333, 0.933333, 0.933333, 1)
@ -206,85 +199,6 @@ grow_vertical = 2
texture = ExtResource("8_ay13l") texture = ExtResource("8_ay13l")
expand_mode = 1 expand_mode = 1
[node name="ButtonPierre" parent="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer" instance=ExtResource("11_ay13l")]
layout_mode = 2
towerType = 1
[node name="TextureRect" parent="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer/ButtonPierre" index="0"]
texture = ExtResource("9_decjp")
[node name="ButtonAline" parent="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer" instance=ExtResource("11_ay13l")]
layout_mode = 2
towerType = 2
[node name="TextureRect" parent="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer/ButtonAline" index="0"]
texture = ExtResource("10_reygo")
[node name="ButtonMaxcence2" parent="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer" instance=ExtResource("11_ay13l")]
layout_mode = 2
towerType = 3
[node name="TextureRect" parent="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer/ButtonMaxcence2" index="0"]
texture = ExtResource("11_76b7g")
[node name="ButtonVictoria" parent="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer" instance=ExtResource("11_ay13l")]
layout_mode = 2
towerType = 4
[node name="TextureRect" parent="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer/ButtonVictoria" index="0"]
texture = ExtResource("12_ih1k6")
[node name="ButtonEvan" parent="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer" instance=ExtResource("11_ay13l")]
layout_mode = 2
towerType = 5
[node name="TextureRect" parent="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer/ButtonEvan" index="0"]
texture = ExtResource("13_ryolu")
[node name="ButtonAlex" parent="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer" instance=ExtResource("11_ay13l")]
layout_mode = 2
towerType = 6
[node name="TextureRect" parent="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer/ButtonAlex" index="0"]
texture = ExtResource("14_hndjt")
[node name="Button11" type="Button" parent="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer"]
custom_minimum_size = Vector2(80, 80)
layout_mode = 2
mouse_default_cursor_shape = 2
[node name="Button12" type="Button" parent="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer"]
custom_minimum_size = Vector2(80, 80)
layout_mode = 2
mouse_default_cursor_shape = 2
[node name="Button13" type="Button" parent="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer"]
custom_minimum_size = Vector2(80, 80)
layout_mode = 2
mouse_default_cursor_shape = 2
[node name="Button14" type="Button" parent="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer"]
custom_minimum_size = Vector2(80, 80)
layout_mode = 2
mouse_default_cursor_shape = 2
[node name="Button15" type="Button" parent="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer"]
custom_minimum_size = Vector2(80, 80)
layout_mode = 2
mouse_default_cursor_shape = 2
[node name="Button16" type="Button" parent="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer"]
custom_minimum_size = Vector2(80, 80)
layout_mode = 2
mouse_default_cursor_shape = 2
[connection signal="pressed" from="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer/ButtonCube" to="." method="_on_button_cube_pressed"] [connection signal="pressed" from="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer/ButtonCube" to="." method="_on_button_cube_pressed"]
[connection signal="pressed" from="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer/ButtonQuitLevel" to="." method="_on_button_quit_level_pressed"] [connection signal="pressed" from="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer/ButtonQuitLevel" to="." method="_on_button_quit_level_pressed"]
[connection signal="pressed" from="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer/ButtonQuitGame" to="." method="_on_button_quit_game_pressed"] [connection signal="pressed" from="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer/ButtonQuitGame" to="." method="_on_button_quit_game_pressed"]
[editable path="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer/ButtonPierre"]
[editable path="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer/ButtonAline"]
[editable path="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer/ButtonMaxcence2"]
[editable path="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer/ButtonVictoria"]
[editable path="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer/ButtonEvan"]
[editable path="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer/ButtonAlex"]

View file

@ -1,49 +0,0 @@
[gd_scene load_steps=3 format=3 uid="uid://he31g7f3ru1c"]
[ext_resource type="PackedScene" uid="uid://bqpeu50pgsdfk" path="res://UI/tower_button.tscn" id="1_txsyf"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_oxe32"]
bg_color = Color(0.921569, 0.890196, 0.415686, 1)
[node name="ShopPanel" type="Panel"]
custom_minimum_size = Vector2(300, 0)
anchors_preset = 11
anchor_left = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 0
grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="PierreButton" parent="VBoxContainer" instance=ExtResource("1_txsyf")]
layout_mode = 2
[node name="EnergyBar" type="ProgressBar" parent="VBoxContainer/PierreButton"]
custom_minimum_size = Vector2(0, 5)
layout_mode = 1
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -4.0
grow_horizontal = 2
grow_vertical = 0
theme_override_styles/fill = SubResource("StyleBoxFlat_oxe32")
show_percentage = false
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
[node name="CancelButton" type="Button" parent="VBoxContainer"]
custom_minimum_size = Vector2(0, 50)
layout_mode = 2
text = "Cancel
"

View file

@ -1,34 +0,0 @@
[gd_scene load_steps=3 format=3 uid="uid://dqb5o8w7u50hc"]
[ext_resource type="Script" uid="uid://dyhtr6g7kd1g2" path="res://UI/tower_button.gd" id="1_3542o"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_decjp"]
bg_color = Color(1, 0.878431, 0, 1)
[node name="TowerButton" type="Button"]
custom_minimum_size = Vector2(80, 80)
offset_right = 80.0
offset_bottom = 80.0
tooltip_text = "Sélectionner Pierre"
mouse_default_cursor_shape = 2
script = ExtResource("1_3542o")
metadata/_custom_type_script = "uid://dyhtr6g7kd1g2"
[node name="TextureRect" type="TextureRect" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
expand_mode = 1
[node name="ProgressBar" type="ProgressBar" parent="."]
layout_mode = 0
offset_left = 1.0
offset_top = 71.0
offset_right = 79.0
offset_bottom = 78.0
mouse_filter = 1
theme_override_styles/fill = SubResource("StyleBoxFlat_decjp")
show_percentage = false

View file

@ -1,14 +1,20 @@
@tool
extends Button extends Button
class_name TowerButton class_name TowerButton
@export var towerType : Tower.TYPES var towerType : Tower.TYPES
func _init() -> void: func _ready() -> void:
#font_outline_color = Color.YELLOW #font_outline_color = Color.YELLOW
if not Engine.is_editor_hint():
pressed.connect(EventBus.tower_selected.emit.bind(towerType))
EventBus.energy_has_changed.connect(changeEnergy) EventBus.energy_has_changed.connect(changeEnergy)
pressed.connect(func(): EventBus.tower_selected.emit(towerType))
func changeEnergy(tower : Tower) -> void: func changeEnergy(tower : Tower) -> void:
if tower.tower_type == towerType: if tower.tower_type == towerType:
$ProgressBar.value = tower.energy $ProgressBar.value = tower.energy
func setButtonTexture(texture : Texture2D) -> void:
$TextureRect.texture = texture

View file

@ -1,25 +1,34 @@
[gd_scene load_steps=4 format=3 uid="uid://bqpeu50pgsdfk"] [gd_scene load_steps=3 format=3 uid="uid://dqb5o8w7u50hc"]
[ext_resource type="Texture2D" uid="uid://dqyhhvxpwtpsy" path="res://Assets/Emotes/emote_star.png" id="1_88p3s"] [ext_resource type="Script" uid="uid://dyhtr6g7kd1g2" path="res://UI/tower_button.gd" id="1_3542o"]
[ext_resource type="Script" uid="uid://dyhtr6g7kd1g2" path="res://UI/tower_button.gd" id="1_i47ne"]
[ext_resource type="PackedScene" uid="uid://trg7ag3dqr2l" path="res://Towers/tower.tscn" id="2_4qiv5"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_decjp"]
bg_color = Color(1, 0.878431, 0, 1)
[node name="TowerButton" type="Button"] [node name="TowerButton" type="Button"]
custom_minimum_size = Vector2(300, 50) custom_minimum_size = Vector2(80, 80)
text = "Pierre offset_right = 80.0
250 Trucs" offset_bottom = 80.0
script = ExtResource("1_i47ne") tooltip_text = "Sélectionner Pierre"
tower = ExtResource("2_4qiv5") mouse_default_cursor_shape = 2
script = ExtResource("1_3542o")
metadata/_custom_type_script = "uid://dyhtr6g7kd1g2"
[node name="TextureRect" type="TextureRect" parent="."] [node name="TextureRect" type="TextureRect" parent="."]
layout_mode = 1 layout_mode = 1
anchors_preset = 4 anchors_preset = 15
anchor_top = 0.5 anchor_right = 1.0
anchor_bottom = 0.5 anchor_bottom = 1.0
offset_top = -20.0 grow_horizontal = 2
offset_right = 40.0
offset_bottom = 20.0
grow_vertical = 2 grow_vertical = 2
texture = ExtResource("1_88p3s") expand_mode = 1
[connection signal="pressed" from="." to="." method="_on_pressed"] [node name="ProgressBar" type="ProgressBar" parent="."]
layout_mode = 0
offset_left = 1.0
offset_top = 71.0
offset_right = 79.0
offset_bottom = 78.0
mouse_filter = 1
theme_override_styles/fill = SubResource("StyleBoxFlat_decjp")
show_percentage = false

View file

@ -1,14 +0,0 @@
[gd_scene load_steps=2 format=3 uid="uid://dbx8ow3v45k4k"]
[ext_resource type="PackedScene" uid="uid://he31g7f3ru1c" path="res://UI/shop_panel.tscn" id="1_2fwl4"]
[node name="UI" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="ShopPanel" parent="." instance=ExtResource("1_2fwl4")]
layout_mode = 1

View file

@ -1,30 +0,0 @@
extends Control
var selected_tower
func _ready() -> void:
EventBus.tower_selected.connect(_on_EventBus_tower_selected)
EventBus.open_shop.connect(open_shop)
EventBus.close_shop.connect(close_shop)
func open_shop():
if visible:
close_shop()
return
visible = true
func close_shop():
visible = false
func _on_EventBus_tower_selected(tower : PackedScene):
selected_tower = tower
func _on_button_return_desktop_pressed() -> void:
get_tree().quit()
func _on_button_back_to_start_screen_pressed() -> void:
Transition.goto("res://UI/start_menu.tscn")
func _on_button_continue_pressed() -> void:
visible = false

View file

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

View file

@ -1,393 +0,0 @@
[gd_scene load_steps=12 format=3 uid="uid://djyye2otjju2d"]
[ext_resource type="Theme" uid="uid://bbp4qcbwkeg7x" path="res://default_theme.tres" id="1_xxfb2"]
[ext_resource type="PackedScene" uid="uid://bqpeu50pgsdfk" path="res://UI/tower_button.tscn" id="2_qus6b"]
[ext_resource type="Script" uid="uid://jg5ny0u7buos" path="res://game_menu.gd" id="2_wr0q8"]
[ext_resource type="Texture2D" uid="uid://cs24awnya7o5p" path="res://Assets/VFX/start_menu_vignette.png" id="3_3rcmp"]
[ext_resource type="Texture2D" uid="uid://uptdcefxlv4c" path="res://Assets/Icones/ppdf_bio_image_placeholder_2.png" id="3_wr0q8"]
[ext_resource type="Script" uid="uid://tn3qdhcyaxsg" path="res://UI/upgrade_button.gd" id="4_3rcmp"]
[ext_resource type="Texture2D" uid="uid://dksohsrys0yy7" path="res://Assets/Icones/baby-face.svg" id="5_pbvm6"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_pbvm6"]
bg_color = Color(0.933333, 0.933333, 0.933333, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_yd342"]
bg_color = Color(0.2, 0.2, 0.2, 0.588235)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_tklej"]
bg_color = Color(0.2, 0.2, 0.2, 0.588235)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_scae6"]
bg_color = Color(0.2, 0.2, 0.2, 0.588235)
[node name="GameMenu" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("1_xxfb2")
script = ExtResource("2_wr0q8")
[node name="Background" type="Panel" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_pbvm6")
[node name="TextureRect" type="TextureRect" parent="Background"]
modulate = Color(1, 1, 1, 0.305882)
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("3_3rcmp")
[node name="MenuHeader" type="HBoxContainer" parent="."]
layout_mode = 1
offset_left = 304.0
offset_right = 1918.0
offset_bottom = 82.0
alignment = 1
[node name="ButtonContinue" type="Button" parent="MenuHeader"]
layout_mode = 2
size_flags_horizontal = 3
text = "Continue"
[node name="ButtonSettings" type="Button" parent="MenuHeader"]
layout_mode = 2
size_flags_horizontal = 3
text = "Settings"
[node name="ButtonBackToStartScreen" type="Button" parent="MenuHeader"]
layout_mode = 2
size_flags_horizontal = 3
text = "Quitter partie"
[node name="ButtonReturnDesktop" type="Button" parent="MenuHeader"]
layout_mode = 2
size_flags_horizontal = 3
text = "Retour bureau"
[node name="ButtonMoney" type="Button" parent="MenuHeader"]
layout_mode = 2
size_flags_horizontal = 3
text = "Money"
[node name="Towers" type="VBoxContainer" parent="."]
layout_mode = 1
offset_right = 300.0
offset_bottom = 722.0
[node name="ButtonCube" type="Button" parent="Towers"]
layout_mode = 2
text = "Cube"
[node name="TowerButtonPierre" parent="Towers" instance=ExtResource("2_qus6b")]
layout_mode = 2
[node name="TowerButtonAline" parent="Towers" instance=ExtResource("2_qus6b")]
visible = false
layout_mode = 2
[node name="TowerButtonMaxence" parent="Towers" instance=ExtResource("2_qus6b")]
visible = false
layout_mode = 2
[node name="TowerButtonAlex" parent="Towers" instance=ExtResource("2_qus6b")]
visible = false
layout_mode = 2
[node name="TowerButtonGeraldine" parent="Towers" instance=ExtResource("2_qus6b")]
visible = false
layout_mode = 2
[node name="CharacterSheet" type="Control" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="TowerStats" type="Panel" parent="CharacterSheet"]
custom_minimum_size = Vector2(800, 512)
layout_mode = 0
offset_left = 313.0
offset_top = 86.0
offset_right = 1113.0
offset_bottom = 598.0
theme_override_styles/panel = SubResource("StyleBoxFlat_yd342")
[node name="MarginContainer2" type="MarginContainer" parent="CharacterSheet/TowerStats"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 20
[node name="HBoxContainer" type="HBoxContainer" parent="CharacterSheet/TowerStats/MarginContainer2"]
layout_mode = 2
[node name="VBoxContainer" type="VBoxContainer" parent="CharacterSheet/TowerStats/MarginContainer2/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="LabelCharacterSheet" type="Label" parent="CharacterSheet/TowerStats/MarginContainer2/HBoxContainer/VBoxContainer"]
layout_mode = 2
text = "Fiche Perso :
FRIANDISE"
horizontal_alignment = 1
[node name="MarginContainer" type="MarginContainer" parent="CharacterSheet/TowerStats/MarginContainer2/HBoxContainer/VBoxContainer"]
custom_minimum_size = Vector2(0, 40)
layout_mode = 2
[node name="StatDamage" type="HBoxContainer" parent="CharacterSheet/TowerStats/MarginContainer2/HBoxContainer/VBoxContainer"]
layout_mode = 2
[node name="NameStat" type="Label" parent="CharacterSheet/TowerStats/MarginContainer2/HBoxContainer/VBoxContainer/StatDamage"]
layout_mode = 2
text = "Damage :"
[node name="Stat" type="Label" parent="CharacterSheet/TowerStats/MarginContainer2/HBoxContainer/VBoxContainer/StatDamage"]
layout_mode = 2
size_flags_horizontal = 3
text = "0"
horizontal_alignment = 2
[node name="StatCooldown" type="HBoxContainer" parent="CharacterSheet/TowerStats/MarginContainer2/HBoxContainer/VBoxContainer"]
layout_mode = 2
[node name="NameStat" type="Label" parent="CharacterSheet/TowerStats/MarginContainer2/HBoxContainer/VBoxContainer/StatCooldown"]
layout_mode = 2
text = "Cooldown :"
[node name="Stat" type="Label" parent="CharacterSheet/TowerStats/MarginContainer2/HBoxContainer/VBoxContainer/StatCooldown"]
layout_mode = 2
size_flags_horizontal = 3
text = "0"
horizontal_alignment = 2
[node name="StatMaxEnergy" type="HBoxContainer" parent="CharacterSheet/TowerStats/MarginContainer2/HBoxContainer/VBoxContainer"]
layout_mode = 2
[node name="NameStat" type="Label" parent="CharacterSheet/TowerStats/MarginContainer2/HBoxContainer/VBoxContainer/StatMaxEnergy"]
layout_mode = 2
text = "Max Energy :"
[node name="Stat" type="Label" parent="CharacterSheet/TowerStats/MarginContainer2/HBoxContainer/VBoxContainer/StatMaxEnergy"]
layout_mode = 2
size_flags_horizontal = 3
text = "0"
horizontal_alignment = 2
[node name="StatRegen" type="HBoxContainer" parent="CharacterSheet/TowerStats/MarginContainer2/HBoxContainer/VBoxContainer"]
layout_mode = 2
[node name="NameStat" type="Label" parent="CharacterSheet/TowerStats/MarginContainer2/HBoxContainer/VBoxContainer/StatRegen"]
layout_mode = 2
text = "Energy Regen :"
[node name="Stat" type="Label" parent="CharacterSheet/TowerStats/MarginContainer2/HBoxContainer/VBoxContainer/StatRegen"]
layout_mode = 2
size_flags_horizontal = 3
text = "0"
horizontal_alignment = 2
[node name="MarginContainer" type="MarginContainer" parent="CharacterSheet/TowerStats/MarginContainer2/HBoxContainer"]
custom_minimum_size = Vector2(20, 0)
layout_mode = 2
[node name="Bio" type="VBoxContainer" parent="CharacterSheet/TowerStats/MarginContainer2/HBoxContainer"]
layout_mode = 2
[node name="BioImage" type="TextureRect" parent="CharacterSheet/TowerStats/MarginContainer2/HBoxContainer/Bio"]
custom_minimum_size = Vector2(300, 300)
layout_mode = 2
texture = ExtResource("3_wr0q8")
expand_mode = 1
[node name="Label" type="Label" parent="CharacterSheet/TowerStats/MarginContainer2/HBoxContainer/Bio"]
custom_minimum_size = Vector2(300, 0)
layout_mode = 2
size_flags_vertical = 3
theme_override_font_sizes/font_size = 30
text = "Aime se promener dans l'herbe et manger des framboises. Sa petite bouille la rend trop mignonne."
horizontal_alignment = 1
autowrap_mode = 2
[node name="TowerUpgrades" type="Panel" parent="CharacterSheet"]
layout_mode = 1
anchors_preset = 3
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -786.0
offset_top = -990.0
offset_right = -19.0
offset_bottom = -28.0
grow_horizontal = 0
grow_vertical = 0
theme_override_styles/panel = SubResource("StyleBoxFlat_tklej")
[node name="MarginContainer2" type="MarginContainer" parent="CharacterSheet/TowerUpgrades"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 20
[node name="VBoxContainer" type="VBoxContainer" parent="CharacterSheet/TowerUpgrades/MarginContainer2"]
layout_mode = 2
theme_override_constants/separation = 10
[node name="Title" type="Label" parent="CharacterSheet/TowerUpgrades/MarginContainer2/VBoxContainer"]
layout_mode = 2
text = "Boutique"
horizontal_alignment = 1
[node name="MarginContainer" type="MarginContainer" parent="CharacterSheet/TowerUpgrades/MarginContainer2/VBoxContainer"]
custom_minimum_size = Vector2(0, 40)
layout_mode = 2
[node name="UpgradeButton" type="Button" parent="CharacterSheet/TowerUpgrades/MarginContainer2/VBoxContainer"]
layout_mode = 2
text = "Upgrade 1"
script = ExtResource("4_3rcmp")
metadata/_custom_type_script = "uid://tn3qdhcyaxsg"
[node name="UpgradeButton2" type="Button" parent="CharacterSheet/TowerUpgrades/MarginContainer2/VBoxContainer"]
layout_mode = 2
text = "Upgrade 2"
script = ExtResource("4_3rcmp")
metadata/_custom_type_script = "uid://tn3qdhcyaxsg"
[node name="UpgradeButton3" type="Button" parent="CharacterSheet/TowerUpgrades/MarginContainer2/VBoxContainer"]
layout_mode = 2
text = "Upgrade 3"
script = ExtResource("4_3rcmp")
metadata/_custom_type_script = "uid://tn3qdhcyaxsg"
[node name="UpgradeButton4" type="Button" parent="CharacterSheet/TowerUpgrades/MarginContainer2/VBoxContainer"]
layout_mode = 2
text = "Upgrade 4"
script = ExtResource("4_3rcmp")
metadata/_custom_type_script = "uid://tn3qdhcyaxsg"
[node name="UpgradeButton5" type="Button" parent="CharacterSheet/TowerUpgrades/MarginContainer2/VBoxContainer"]
layout_mode = 2
text = "Upgrade 5"
script = ExtResource("4_3rcmp")
metadata/_custom_type_script = "uid://tn3qdhcyaxsg"
[node name="TowerSkills" type="Panel" parent="CharacterSheet"]
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -646.0
offset_top = -471.0
offset_right = 153.0
offset_bottom = -28.0
grow_horizontal = 2
grow_vertical = 0
theme_override_styles/panel = SubResource("StyleBoxFlat_scae6")
[node name="MarginContainer" type="MarginContainer" parent="CharacterSheet/TowerSkills"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 20
[node name="VBoxContainer" type="VBoxContainer" parent="CharacterSheet/TowerSkills/MarginContainer"]
layout_mode = 2
[node name="Title" type="Label" parent="CharacterSheet/TowerSkills/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Capacités"
horizontal_alignment = 1
[node name="MarginContainer" type="MarginContainer" parent="CharacterSheet/TowerSkills/MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="SkillUI" type="HBoxContainer" parent="CharacterSheet/TowerSkills/MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="Icone" type="TextureRect" parent="CharacterSheet/TowerSkills/MarginContainer/VBoxContainer/SkillUI"]
custom_minimum_size = Vector2(64, 64)
layout_mode = 2
texture = ExtResource("5_pbvm6")
expand_mode = 1
[node name="MarginContainer" type="MarginContainer" parent="CharacterSheet/TowerSkills/MarginContainer/VBoxContainer/SkillUI"]
custom_minimum_size = Vector2(20, 0)
layout_mode = 2
[node name="Label" type="Label" parent="CharacterSheet/TowerSkills/MarginContainer/VBoxContainer/SkillUI"]
layout_mode = 2
text = "Bonjour"
[node name="SkillUI2" type="HBoxContainer" parent="CharacterSheet/TowerSkills/MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="Icone" type="TextureRect" parent="CharacterSheet/TowerSkills/MarginContainer/VBoxContainer/SkillUI2"]
custom_minimum_size = Vector2(64, 64)
layout_mode = 2
texture = ExtResource("5_pbvm6")
expand_mode = 1
[node name="MarginContainer" type="MarginContainer" parent="CharacterSheet/TowerSkills/MarginContainer/VBoxContainer/SkillUI2"]
custom_minimum_size = Vector2(20, 0)
layout_mode = 2
[node name="Label" type="Label" parent="CharacterSheet/TowerSkills/MarginContainer/VBoxContainer/SkillUI2"]
layout_mode = 2
text = "Compliments"
[node name="SkillUI3" type="HBoxContainer" parent="CharacterSheet/TowerSkills/MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="Icone" type="TextureRect" parent="CharacterSheet/TowerSkills/MarginContainer/VBoxContainer/SkillUI3"]
custom_minimum_size = Vector2(64, 64)
layout_mode = 2
texture = ExtResource("5_pbvm6")
expand_mode = 1
[node name="MarginContainer" type="MarginContainer" parent="CharacterSheet/TowerSkills/MarginContainer/VBoxContainer/SkillUI3"]
custom_minimum_size = Vector2(20, 0)
layout_mode = 2
[node name="Label" type="Label" parent="CharacterSheet/TowerSkills/MarginContainer/VBoxContainer/SkillUI3"]
layout_mode = 2
text = "Cinéphile"
[connection signal="pressed" from="MenuHeader/ButtonContinue" to="." method="_on_button_continue_pressed"]
[connection signal="pressed" from="MenuHeader/ButtonBackToStartScreen" to="." method="_on_button_back_to_start_screen_pressed"]
[connection signal="pressed" from="MenuHeader/ButtonReturnDesktop" to="." method="_on_button_return_desktop_pressed"]