selection WIP
This commit is contained in:
parent
cec498998d
commit
d7aab627f6
8 changed files with 43 additions and 8 deletions
|
|
@ -116,14 +116,16 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4.73017, 0.728414, 0)
|
||||||
script = ExtResource("3_ju8gl")
|
script = ExtResource("3_ju8gl")
|
||||||
|
|
||||||
[node name="Sprite3DSelection" type="Sprite3D" parent="PlayerManager"]
|
[node name="Sprite3DSelection" type="Sprite3D" parent="PlayerManager"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.3, 0)
|
|
||||||
modulate = Color(0.966071, 0.695469, 0, 1)
|
modulate = Color(0.966071, 0.695469, 0, 1)
|
||||||
pixel_size = 0.015
|
pixel_size = 0.03
|
||||||
|
axis = 1
|
||||||
billboard = 2
|
billboard = 2
|
||||||
alpha_cut = 1
|
alpha_cut = 1
|
||||||
texture = ExtResource("3_ikoig")
|
texture = ExtResource("3_ikoig")
|
||||||
region_enabled = true
|
hframes = 15
|
||||||
region_rect = Rect2(155, 0, 29, 35)
|
vframes = 7
|
||||||
|
frame = 44
|
||||||
|
region_rect = Rect2(703, 96, 21, 30)
|
||||||
|
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="PlayerManager"]
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="PlayerManager"]
|
||||||
libraries = {
|
libraries = {
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ var selected_collider : CollisionObject3D
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
EventBus.tower_selected.connect(_on_EventBus_tower_selected)
|
EventBus.tower_selected.connect(_on_EventBus_tower_selected)
|
||||||
EventBus.tower_to_build.connect(_on_EventBus_tower_to_build)
|
EventBus.tower_to_build.connect(_on_EventBus_tower_to_build)
|
||||||
$AnimationPlayer.play("arrow_bobbing")
|
#$AnimationPlayer.play("arrow_bobbing")
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
handle_player_controls()
|
handle_player_controls()
|
||||||
|
|
@ -81,8 +81,9 @@ func handle_player_controls() -> void:
|
||||||
var collider : CollisionObject3D = ray_result.get("collider")
|
var collider : CollisionObject3D = ray_result.get("collider")
|
||||||
selected_collider = collider
|
selected_collider = collider
|
||||||
visible = true
|
visible = true
|
||||||
|
selection_icon.visible = false
|
||||||
global_position = collider.global_position
|
global_position = collider.global_position
|
||||||
global_position += Vector3(0.0,0.2,0.0)
|
global_position += Vector3(0.0,0.02,0.0)
|
||||||
|
|
||||||
if selected_collider is Tower:
|
if selected_collider is Tower:
|
||||||
target_tower = collider
|
target_tower = collider
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5, 0, 0.5)
|
||||||
[node name="tile2" parent="." instance=ExtResource("1_71op4")]
|
[node name="tile2" parent="." instance=ExtResource("1_71op4")]
|
||||||
|
|
||||||
[node name="StaticBody3D" type="StaticBody3D" parent="."]
|
[node name="StaticBody3D" type="StaticBody3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, -1, 8.74228e-08, 0, -8.74228e-08, -1, 0, 0.2, 0)
|
||||||
script = ExtResource("1_2ljfi")
|
script = ExtResource("1_2ljfi")
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D"]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D"]
|
||||||
|
|
|
||||||
2
Towers/aline.gd
Normal file
2
Towers/aline.gd
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
extends Tower
|
||||||
|
class_name Aline
|
||||||
1
Towers/aline.gd.uid
Normal file
1
Towers/aline.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://16hafh01iv
|
||||||
15
Towers/aline.tscn
Normal file
15
Towers/aline.tscn
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
[gd_scene load_steps=4 format=3 uid="uid://btmhe8ah6eexf"]
|
||||||
|
|
||||||
|
[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.gd" id="2_6sjqq"]
|
||||||
|
[ext_resource type="Script" uid="uid://bg0x4egeu17qb" path="res://Scripts/Upgrades/TowerUpgrade.gd" id="3_p2nb1"]
|
||||||
|
|
||||||
|
[node name="Aline" instance=ExtResource("1_gvvig")]
|
||||||
|
script = ExtResource("2_6sjqq")
|
||||||
|
icone = null
|
||||||
|
bio = ""
|
||||||
|
bullet_damage = 1
|
||||||
|
tower_shop = Array[ExtResource("3_p2nb1")]([])
|
||||||
|
|
||||||
|
[node name="Sprite3D" parent="." index="6"]
|
||||||
|
frame = 56
|
||||||
12
UI/gui.gd
12
UI/gui.gd
|
|
@ -27,3 +27,15 @@ func _on_button_pierre_pressed() -> void:
|
||||||
if can_build: #If Pierre is not builded then build it !
|
if can_build: #If Pierre is not builded then build it !
|
||||||
print("can build !")
|
print("can build !")
|
||||||
EventBus.tower_to_build.emit(load("res://Towers/pierre.tscn"))
|
EventBus.tower_to_build.emit(load("res://Towers/pierre.tscn"))
|
||||||
|
|
||||||
|
|
||||||
|
func _on_button_aline_pressed() -> void:
|
||||||
|
var can_build = true
|
||||||
|
for tower in player_manager.towers:
|
||||||
|
if tower is Pierre:
|
||||||
|
can_build = false
|
||||||
|
player_manager.selected_tower = tower #If can't build, tower is selected
|
||||||
|
|
||||||
|
if can_build: #If Pierre is not builded then build it !
|
||||||
|
print("can build !")
|
||||||
|
EventBus.tower_to_build.emit(load("res://Towers/aline.tscn"))
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
[gd_scene load_steps=23 format=3 uid="uid://p6a6rb7sgeqd"]
|
[gd_scene load_steps=23 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" 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"]
|
||||||
[ext_resource type="Script" uid="uid://bhylcok1l6eke" path="res://UI/gui.gd" id="2_sac4j"]
|
[ext_resource type="Script" uid="uid://bhylcok1l6eke" path="res://UI/gui.gd" id="2_sac4j"]
|
||||||
[ext_resource type="Script" uid="uid://dmcgoepvytnn" path="res://UI/cube_integrity.gd" id="2_sj6ny"]
|
[ext_resource type="Script" uid="uid://dmcgoepvytnn" path="res://UI/cube_integrity.gd" id="2_sj6ny"]
|
||||||
[ext_resource type="Script" path="res://UI/label_tower_on_terrain.gd" id="3_wg577"]
|
[ext_resource type="Script" uid="uid://kngsgirej7lx" path="res://UI/label_tower_on_terrain.gd" id="3_wg577"]
|
||||||
[ext_resource type="Theme" uid="uid://bbp4qcbwkeg7x" path="res://default_theme.tres" id="5_wpcnu"]
|
[ext_resource type="Theme" uid="uid://bbp4qcbwkeg7x" path="res://default_theme.tres" id="5_wpcnu"]
|
||||||
[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"]
|
||||||
|
|
@ -349,3 +349,4 @@ mouse_default_cursor_shape = 2
|
||||||
[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"]
|
||||||
[connection signal="pressed" from="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer/ButtonPierre" to="." method="_on_button_pierre_pressed"]
|
[connection signal="pressed" from="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer/ButtonPierre" to="." method="_on_button_pierre_pressed"]
|
||||||
|
[connection signal="pressed" from="HBoxContainer/ControlPanelBase/MarginContainer/GridContainer/ButtonAline" to="." method="_on_button_aline_pressed"]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue