pathfinding rework for now
This commit is contained in:
185
PCs/PathEditTool/path_edit_tool.gd
Normal file
185
PCs/PathEditTool/path_edit_tool.gd
Normal file
@ -0,0 +1,185 @@
|
||||
class_name PathEditTool extends Node3D
|
||||
|
||||
@export var hero: Hero
|
||||
@export var inventory: Inventory
|
||||
@export var ray: RayCast3D
|
||||
@export var wall_preview: TowerBase
|
||||
@export var progress_bar: TextureProgressBar
|
||||
|
||||
var enabled: bool = true
|
||||
var point: FlowNode = null
|
||||
var obstacle_last_point: int = -1
|
||||
var valid_point: bool = false # a point is valid if the path would still be traversable overall if this point was made untraversable
|
||||
var tower_preview: Tower
|
||||
var ray_collider: Object
|
||||
var ray_point: Vector3
|
||||
var last_point: FlowNode = null
|
||||
var last_tower_base: TowerBase
|
||||
|
||||
var interact_key_held: bool = false
|
||||
var interacted_once: bool = false
|
||||
var interact_held_time: float = 0.0
|
||||
var interact_hold_time: float = 0.4
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
var c: Color = Color.GREEN
|
||||
c.a = 0.8
|
||||
wall_preview.set_color(c)
|
||||
wall_preview.set_float(0.0)
|
||||
wall_preview.toggle_collision()
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if !enabled:
|
||||
ray_collider = null
|
||||
wall_preview.set_visible(false)
|
||||
return
|
||||
|
||||
if interact_key_held:
|
||||
if !interacted_once:
|
||||
if valid_point and hero.currency >= Data.wall_cost and ray.is_colliding() and point.buildable:
|
||||
interact_held_time += delta
|
||||
set_progress_percent(interact_held_time / interact_hold_time)
|
||||
wall_preview.set_float(interact_held_time / interact_hold_time)
|
||||
if interact_held_time >= interact_hold_time:
|
||||
set_progress_percent(0)
|
||||
interacted_once = true
|
||||
build_wall()
|
||||
elif ray.is_colliding() and ray.get_collider() is TowerBase:
|
||||
interact_held_time += delta
|
||||
set_progress_percent(interact_held_time / interact_hold_time)
|
||||
if interact_held_time >= interact_hold_time:
|
||||
set_progress_percent(0)
|
||||
interacted_once = true
|
||||
refund_wall(ray.get_collider())
|
||||
else:
|
||||
interact_held_time = 0.0
|
||||
interacted_once = false
|
||||
set_progress_percent(0)
|
||||
wall_preview.set_float(0.0)
|
||||
|
||||
if !interacted_once and ray.is_colliding():
|
||||
#if statement makes sure once the building animation has started then
|
||||
#the position the wall builds in is already decided and moving the mouse
|
||||
#around isnt going to make the resulting
|
||||
#wall teleport to the new mouse location
|
||||
if !interact_key_held:
|
||||
wall_preview.set_visible(true)
|
||||
if is_instance_valid(ray_collider) and ray_collider is TowerBase:
|
||||
Game.level.walls[ray_collider.point].set_float(1.0)
|
||||
ray_collider = ray.get_collider()
|
||||
ray_point = ray.get_collision_point()
|
||||
|
||||
if ray_collider is TowerBase:
|
||||
process_looking_at_tower()
|
||||
elif Game.level:
|
||||
process_looking_at_level()
|
||||
else:
|
||||
if is_instance_valid(ray_collider) and ray_collider is TowerBase and Game.level.walls.has(ray_collider.point):
|
||||
Game.level.walls[ray_collider.point].set_float(1.0)
|
||||
ray_collider = null
|
||||
delete_tower_preview()
|
||||
wall_preview.set_visible(false)
|
||||
clear_previous_point()
|
||||
last_point = null
|
||||
if !valid_point:
|
||||
wall_preview.set_visible(false)
|
||||
|
||||
|
||||
func process_looking_at_level() -> void:
|
||||
if tower_preview:
|
||||
delete_tower_preview()
|
||||
point = Game.level.flow_field.get_closest_buildable_point(ray_point)
|
||||
if Game.level.walls.has(point) or !point.buildable or hero.currency < Data.wall_cost:
|
||||
wall_preview.set_visible(false)
|
||||
valid_point = false
|
||||
clear_previous_point()
|
||||
last_point = point
|
||||
else:
|
||||
wall_preview.global_position = point.global_position
|
||||
wall_preview.global_rotation = Vector3.ZERO
|
||||
if last_point != point:
|
||||
clear_previous_point()
|
||||
last_point = point
|
||||
if !Game.level.walls.has(point) and Game.level.flow_field.traversable_after_blocking_point(point):
|
||||
Game.level.flow_field.toggle_traversable(point)
|
||||
wall_preview.set_float(0.0)
|
||||
valid_point = true
|
||||
else:
|
||||
valid_point = false
|
||||
|
||||
|
||||
func clear_previous_point() -> void:
|
||||
if last_point and !Game.level.walls.has(last_point) and !last_point.traversable:
|
||||
Game.level.flow_field.toggle_traversable(last_point)
|
||||
|
||||
|
||||
func process_looking_at_tower() -> void:
|
||||
valid_point = false
|
||||
point = ray_collider.point
|
||||
if last_point != point:
|
||||
clear_previous_point()
|
||||
|
||||
if tower_preview:
|
||||
delete_tower_preview()
|
||||
wall_preview.set_visible(false)
|
||||
ray_collider.set_color(Color.RED)
|
||||
ray_collider.set_float(0.0)
|
||||
if inventory.contents.size() > 0 and !ray_collider.has_card:
|
||||
if ray_collider != last_tower_base or inventory.selected_item != inventory.contents.keys()[hero.inventory_selected_index]:
|
||||
spawn_tower_preview()
|
||||
|
||||
|
||||
func spawn_tower_preview() -> void:
|
||||
delete_tower_preview()
|
||||
last_tower_base = ray_collider
|
||||
var card: Card = inventory.contents.keys()[hero.inventory_selected_index]
|
||||
tower_preview = card.turret_scene.instantiate() as Tower
|
||||
tower_preview.stats = card.tower_stats
|
||||
tower_preview.position = Vector3.UP
|
||||
tower_preview.preview_range(true)
|
||||
ray_collider.add_child(tower_preview)
|
||||
|
||||
|
||||
func delete_tower_preview() -> void:
|
||||
last_tower_base = null
|
||||
if is_instance_valid(tower_preview):
|
||||
tower_preview.queue_free()
|
||||
tower_preview = null
|
||||
|
||||
|
||||
func interact() -> void:
|
||||
if ray_collider is TowerBase:
|
||||
var tower_base: TowerBase = ray_collider as TowerBase
|
||||
put_card_in_tower_base(tower_base)
|
||||
|
||||
|
||||
func build_wall() -> void:
|
||||
if point and valid_point and hero.currency >= Data.wall_cost:
|
||||
hero.currency -= Data.wall_cost
|
||||
Game.level.set_wall(point, multiplayer.get_unique_id())
|
||||
wall_preview.visible = false
|
||||
|
||||
|
||||
func refund_wall(wall: TowerBase) -> void:
|
||||
if !is_instance_valid(wall):
|
||||
return
|
||||
if wall.has_card:
|
||||
wall.remove_card()
|
||||
Game.level.remove_wall(wall.point)
|
||||
|
||||
|
||||
func put_card_in_tower_base(tower_base: TowerBase) -> void:
|
||||
if tower_base.has_card:
|
||||
tower_base.remove_card()
|
||||
elif inventory.size > 0:
|
||||
var card: Card = inventory.remove_at(hero.inventory_selected_index)
|
||||
if !inventory.contents.has(card):
|
||||
hero.decrement_selected()
|
||||
tower_base.add_card(card, multiplayer.get_unique_id())
|
||||
hero.place_card_audio.play()
|
||||
|
||||
|
||||
func set_progress_percent(value: float) -> void:
|
||||
progress_bar.value = progress_bar.max_value * value
|
1
PCs/PathEditTool/path_edit_tool.gd.uid
Normal file
1
PCs/PathEditTool/path_edit_tool.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://ckm02cx0ai624
|
35
PCs/PathEditTool/path_edit_tool.tscn
Normal file
35
PCs/PathEditTool/path_edit_tool.tscn
Normal file
@ -0,0 +1,35 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://dqt1ggtkpkuhs"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ckm02cx0ai624" path="res://PCs/PathEditTool/path_edit_tool.gd" id="1_l8cck"]
|
||||
[ext_resource type="PackedScene" uid="uid://ddbbwx0yy16lh" path="res://Scenes/TowerBase/tower_base.tscn" id="2_pjtpe"]
|
||||
[ext_resource type="Texture2D" uid="uid://gh4yvnerf1f5" path="res://Assets/Textures/radial.png" id="3_fs118"]
|
||||
|
||||
[node name="PathEditTool" type="Node3D" node_paths=PackedStringArray("ray", "wall_preview", "progress_bar")]
|
||||
script = ExtResource("1_l8cck")
|
||||
ray = NodePath("RayCast3D")
|
||||
wall_preview = NodePath("WallPreview")
|
||||
progress_bar = NodePath("ProgressBar")
|
||||
|
||||
[node name="RayCast3D" type="RayCast3D" parent="."]
|
||||
target_position = Vector3(0, 0, -20)
|
||||
collision_mask = 25
|
||||
|
||||
[node name="WallPreview" parent="." instance=ExtResource("2_pjtpe")]
|
||||
|
||||
[node name="ProgressBar" type="TextureProgressBar" parent="."]
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -90.0
|
||||
offset_top = -90.0
|
||||
offset_right = 90.0
|
||||
offset_bottom = 90.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
scale = Vector2(0.5, 0.5)
|
||||
pivot_offset = Vector2(90, 90)
|
||||
step = 0.0
|
||||
fill_mode = 4
|
||||
texture_progress = ExtResource("3_fs118")
|
@ -10,7 +10,7 @@ signal ready_state_changed(state: bool)
|
||||
@export var left_hand: Node3D
|
||||
@export var right_hand: Node3D
|
||||
@export var right_hand_animator: AnimationPlayer
|
||||
@export var edit_tool: EditTool
|
||||
@export var edit_tool: PathEditTool
|
||||
@export var gauntlet_sprite: Sprite3D
|
||||
@export var sprite: EightDirectionSprite3D
|
||||
@export var hand_sprite: Sprite2D
|
||||
@ -120,7 +120,7 @@ func _process(delta: float) -> void:
|
||||
hovering_item.disable_hover_effect()
|
||||
hovering_item = null
|
||||
|
||||
if edit_tool.is_looking_at_tower_base:
|
||||
if is_instance_valid(edit_tool.ray_collider) and edit_tool.ray_collider is TowerBase:
|
||||
card_sprites[0].view_tower()
|
||||
else:
|
||||
card_sprites[0].view_weapon()
|
||||
|
178
PCs/hero.tscn
178
PCs/hero.tscn
@ -7,7 +7,7 @@
|
||||
[ext_resource type="PackedScene" uid="uid://buvgdem68wtev" path="res://Scenes/Menus/PauseMenu/pause_menu.tscn" id="3_avnsx"]
|
||||
[ext_resource type="Script" uid="uid://cij76at0nbs1v" path="res://PCs/view_movement.gd" id="4_mhexa"]
|
||||
[ext_resource type="PackedScene" uid="uid://dixtx38u4jhd7" path="res://Scenes/UI/card_hand.tscn" id="4_mwtvp"]
|
||||
[ext_resource type="PackedScene" uid="uid://dqt1ggtkpkuhs" path="res://Scenes/gauntlet.tscn" id="5_jlxb3"]
|
||||
[ext_resource type="PackedScene" uid="uid://dqt1ggtkpkuhs" path="res://PCs/PathEditTool/path_edit_tool.tscn" id="5_jlxb3"]
|
||||
[ext_resource type="Script" uid="uid://do24iuot0j7d7" path="res://Scripts/inventory.gd" id="6_cf5ap"]
|
||||
[ext_resource type="Texture2D" uid="uid://cjqxkraykhxxk" path="res://Classes/Engineer/red.png" id="6_yyp8i"]
|
||||
[ext_resource type="Script" uid="uid://b6kjrl7ae1mi0" path="res://PCs/hud.gd" id="8_yl6ka"]
|
||||
@ -20,13 +20,14 @@
|
||||
[ext_resource type="Texture2D" uid="uid://chhmkmlfrobhu" path="res://Assets/Textures/bubble.png" id="15_q3yot"]
|
||||
[ext_resource type="Texture2D" uid="uid://cqnapc8cscl7i" path="res://Assets/Textures/border.png" id="16_x1xjr"]
|
||||
[ext_resource type="PackedScene" uid="uid://chnj376d3lcjd" path="res://Scenes/UI/pickup_notification.tscn" id="17_oyeww"]
|
||||
[ext_resource type="PackedScene" uid="uid://d17c77pqsi8oy" path="res://enemy_card_ui.tscn" id="18_dfkac"]
|
||||
[ext_resource type="PackedScene" uid="uid://d17c77pqsi8oy" path="res://UI/EnemyCard/enemy_card_ui.tscn" id="18_dfkac"]
|
||||
[ext_resource type="Texture2D" uid="uid://cvjcu3hofahr6" path="res://Assets/Textures/place_slot.png" id="18_okmpi"]
|
||||
[ext_resource type="Script" uid="uid://b5wle8f6rv3e7" path="res://PCs/player_movement.gd" id="20_cfhw8"]
|
||||
[ext_resource type="Shader" uid="uid://dhtylicctk3g4" path="res://UI/crosshair.gdshader" id="20_gxpgc"]
|
||||
[ext_resource type="AudioStream" uid="uid://csu2hce4bfoki" path="res://Audio/cardPlace1.ogg" id="24_8ch4w"]
|
||||
[ext_resource type="AudioStream" uid="uid://dxq8b77wa41os" path="res://Audio/cardPlace2.ogg" id="25_awl6m"]
|
||||
[ext_resource type="Texture2D" uid="uid://bs2mskoyvyehv" path="res://Assets/Textures/crosshair159.png" id="25_l7gpx"]
|
||||
[ext_resource type="AudioStream" uid="uid://bxripx3suub1v" path="res://Audio/cardPlace3.ogg" id="26_7tm07"]
|
||||
[ext_resource type="Texture2D" uid="uid://0x80ptif1diq" path="res://Assets/Textures/hand_small_point.png" id="26_dfkac"]
|
||||
[ext_resource type="PackedScene" uid="uid://c2id8hjico4w8" path="res://energy_bar.tscn" id="27_14ugt"]
|
||||
[ext_resource type="AudioStream" uid="uid://k1lsqkvohjpa" path="res://Audio/cardPlace4.ogg" id="27_xvxs8"]
|
||||
[ext_resource type="AudioStream" uid="uid://bn8lkvy5wibvo" path="res://Audio/cardSlide1.ogg" id="28_1thk8"]
|
||||
@ -94,21 +95,6 @@ viewport_path = NodePath("FirstPersonViewport")
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_574jy"]
|
||||
viewport_path = NodePath("MiniMapViewport")
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_lg5jo"]
|
||||
shader = ExtResource("20_gxpgc")
|
||||
shader_parameter/center_enabled = true
|
||||
shader_parameter/legs_enabled = true
|
||||
shader_parameter/inverted = false
|
||||
shader_parameter/color_id = 0
|
||||
shader_parameter/color_0 = Vector4(1, 0, 0, 0.95)
|
||||
shader_parameter/color_1 = Vector4(1, 0, 0, 1)
|
||||
shader_parameter/color_2 = Vector4(0, 0, 1, 1)
|
||||
shader_parameter/center_radius = 0.002
|
||||
shader_parameter/width = 0.002
|
||||
shader_parameter/len = 0.012
|
||||
shader_parameter/spacing = 0.008
|
||||
shader_parameter/spread = 1.0
|
||||
|
||||
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_tsiqi"]
|
||||
properties/0/path = NodePath(".:position")
|
||||
properties/0/spawn = true
|
||||
@ -382,19 +368,18 @@ max_look_down_angle = 80.0
|
||||
max_look_up_angle = 80.0
|
||||
enable_jumping = true
|
||||
|
||||
[node name="HUD" type="CanvasLayer" parent="." node_paths=PackedStringArray("player", "wave_count", "lives_count", "currency_count", "minimap_outline", "crosshair", "minimap", "minimap_cam", "minimap_viewport", "fps_label", "hover_text", "enemy_sprites", "enemy_counts", "wave_start_label", "place_icon", "swap_icon", "place_text", "swap_text", "new_energy_bar")]
|
||||
[node name="HUD" type="CanvasLayer" parent="." node_paths=PackedStringArray("player", "wave_count", "lives_count", "currency_count", "minimap_outline", "minimap", "minimap_cam", "minimap_viewport", "fps_label", "hover_text", "enemy_sprites", "enemy_counts", "wave_start_label", "place_icon", "swap_icon", "place_text", "swap_text", "new_energy_bar")]
|
||||
script = ExtResource("8_yl6ka")
|
||||
player = NodePath("..")
|
||||
wave_count = NodePath("WaveCount")
|
||||
lives_count = NodePath("LivesCount")
|
||||
currency_count = NodePath("CurrencyCount")
|
||||
minimap_outline = NodePath("MinimapBorder")
|
||||
crosshair = NodePath("Crosshair")
|
||||
wave_count = NodePath("EnemyTracker/WaveCount")
|
||||
lives_count = NodePath("LivesBar/LivesCount")
|
||||
currency_count = NodePath("Minimap/CurrencyCount")
|
||||
minimap_outline = NodePath("Minimap/MinimapBorder")
|
||||
minimap = NodePath("Minimap")
|
||||
minimap_cam = NodePath("../MiniMapViewport/Camera3D")
|
||||
minimap_viewport = NodePath("../MiniMapViewport")
|
||||
fps_label = NodePath("FPSCounter")
|
||||
hover_text = NodePath("RichTextLabel2")
|
||||
hover_text = NodePath("InteractLabel")
|
||||
enemy_sprites = [NodePath("EnemyTracker/TextureRect"), NodePath("EnemyTracker/TextureRect2"), NodePath("EnemyTracker/TextureRect3"), NodePath("EnemyTracker/TextureRect4"), NodePath("EnemyTracker/TextureRect5")]
|
||||
enemy_counts = [NodePath("EnemyTracker/TextureRect/Label"), NodePath("EnemyTracker/TextureRect2/Label2"), NodePath("EnemyTracker/TextureRect3/Label3"), NodePath("EnemyTracker/TextureRect4/Label4"), NodePath("EnemyTracker/TextureRect5/Label5")]
|
||||
pickup_notif_scene = ExtResource("17_oyeww")
|
||||
@ -481,6 +466,35 @@ grow_horizontal = 0
|
||||
mouse_filter = 2
|
||||
texture = SubResource("ViewportTexture_574jy")
|
||||
|
||||
[node name="MinimapBorder" type="TextureRect" parent="HUD/Minimap"]
|
||||
texture_filter = 1
|
||||
layout_mode = 1
|
||||
anchors_preset = 1
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
offset_left = -259.0
|
||||
offset_top = -3.0
|
||||
offset_right = 3.0
|
||||
offset_bottom = 333.0
|
||||
grow_horizontal = 0
|
||||
mouse_filter = 2
|
||||
texture = ExtResource("16_x1xjr")
|
||||
|
||||
[node name="CurrencyCount" type="Label" parent="HUD/Minimap"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 1
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
offset_left = -61.0
|
||||
offset_top = 260.0
|
||||
offset_bottom = 318.0
|
||||
grow_horizontal = 0
|
||||
theme_override_colors/font_color = Color(0.988235, 0.909804, 0.65098, 1)
|
||||
theme_override_font_sizes/font_size = 37
|
||||
text = "20"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="FPSCounter" type="Label" parent="HUD"]
|
||||
anchors_preset = 1
|
||||
anchor_left = 1.0
|
||||
@ -505,31 +519,17 @@ grow_vertical = 1
|
||||
scale = Vector2(3, 3)
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="LivesCount" type="Label" parent="HUD"]
|
||||
offset_left = -2.24
|
||||
offset_top = 23.28
|
||||
offset_right = 102.76
|
||||
offset_bottom = 112.28
|
||||
[node name="LivesCount" type="Label" parent="HUD/LivesBar"]
|
||||
layout_mode = 0
|
||||
offset_right = 79.0
|
||||
offset_bottom = 70.0
|
||||
scale = Vector2(0.33, 0.33)
|
||||
theme_override_colors/font_color = Color(0.65098, 0.227451, 0.243137, 1)
|
||||
theme_override_font_sizes/font_size = 37
|
||||
text = "120
|
||||
"
|
||||
text = "120"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="MinimapBorder" type="TextureRect" parent="HUD"]
|
||||
texture_filter = 1
|
||||
anchors_preset = 1
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
offset_left = -262.0
|
||||
offset_top = 37.0
|
||||
offset_right = -37.0
|
||||
offset_bottom = 336.0
|
||||
grow_horizontal = 0
|
||||
mouse_filter = 2
|
||||
texture = ExtResource("16_x1xjr")
|
||||
|
||||
[node name="EnemyTracker" type="TextureRect" parent="HUD"]
|
||||
texture_filter = 1
|
||||
anchors_preset = 5
|
||||
@ -652,22 +652,23 @@ text = "999"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="CurrencyCount" type="Label" parent="HUD"]
|
||||
anchors_preset = 1
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
offset_left = -101.0
|
||||
offset_top = 300.0
|
||||
offset_right = -40.0
|
||||
offset_bottom = 54.0
|
||||
grow_horizontal = 0
|
||||
theme_override_colors/font_color = Color(0.988235, 0.909804, 0.65098, 1)
|
||||
theme_override_font_sizes/font_size = 37
|
||||
text = "20"
|
||||
[node name="WaveCount" type="Label" parent="HUD/EnemyTracker"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 5
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
offset_left = -30.0
|
||||
offset_top = 59.0
|
||||
offset_right = 30.0
|
||||
offset_bottom = 87.0
|
||||
grow_horizontal = 2
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
theme_override_font_sizes/font_size = 18
|
||||
text = "1"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="RichTextLabel2" type="RichTextLabel" parent="HUD"]
|
||||
[node name="InteractLabel" type="RichTextLabel" parent="HUD"]
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
@ -687,30 +688,6 @@ bbcode_enabled = true
|
||||
text = "[center]Press Button To do thing"
|
||||
scroll_active = false
|
||||
|
||||
[node name="WaveCount" type="Label" parent="HUD"]
|
||||
anchors_preset = 5
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
offset_left = -30.0
|
||||
offset_top = 81.0
|
||||
offset_right = 30.0
|
||||
offset_bottom = 109.0
|
||||
grow_horizontal = 2
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
theme_override_font_sizes/font_size = 18
|
||||
text = "1"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Crosshair" type="ColorRect" parent="HUD"]
|
||||
material = SubResource("ShaderMaterial_lg5jo")
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="HUD"]
|
||||
anchors_preset = 4
|
||||
anchor_top = 0.5
|
||||
@ -757,8 +734,45 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="EnergyBar" parent="HUD" instance=ExtResource("27_14ugt")]
|
||||
visible = false
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="HUD"]
|
||||
modulate = Color(0.54324, 0.193653, 0.15885, 0.9)
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -20.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 20.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
texture = ExtResource("25_l7gpx")
|
||||
expand_mode = 3
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="TextureRect2" type="TextureRect" parent="HUD"]
|
||||
visible = false
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -20.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 20.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
texture = ExtResource("26_dfkac")
|
||||
expand_mode = 3
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="WeaponSwapTimer" type="Timer" parent="."]
|
||||
wait_time = 0.4
|
||||
one_shot = true
|
||||
|
16
PCs/hud.gd
16
PCs/hud.gd
@ -93,12 +93,16 @@ func tween_label(x: float) -> void:
|
||||
|
||||
|
||||
func set_hover_text(text: String) -> void:
|
||||
$TextureRect2.visible = true
|
||||
$TextureRect.visible = false
|
||||
hover_text.text = parse_action_tag(text)
|
||||
hover_text.set_visible(true)
|
||||
hover_text.visible = true
|
||||
|
||||
|
||||
func unset_hover_text() -> void:
|
||||
hover_text.set_visible(false)
|
||||
hover_text.visible = false
|
||||
$TextureRect2.visible = false
|
||||
$TextureRect.visible = true
|
||||
|
||||
|
||||
func set_wave_count(value: int) -> void:
|
||||
@ -125,8 +129,12 @@ func set_upcoming_wave(value: Dictionary) -> void:
|
||||
var frame_count: int = 0
|
||||
enemy_names = []
|
||||
var wave: Dictionary = {}
|
||||
for index: int in value:
|
||||
wave[Data.enemies[index]] = value[index]
|
||||
for key: String in value:
|
||||
var new_enemy: Enemy
|
||||
for enemy: Enemy in Data.enemies:
|
||||
if enemy.title == key:
|
||||
new_enemy = enemy
|
||||
wave[new_enemy] = value[key]
|
||||
for x: int in enemy_sprites.size():
|
||||
enemy_sprites[x].set_visible(false)
|
||||
enemy_counts[x].set_visible(false)
|
||||
|
Reference in New Issue
Block a user