diff options
Diffstat (limited to 'Towers')
-rw-r--r-- | Towers/Assets/.spritesheet.png-autosave.kra | bin | 0 -> 79919 bytes | |||
-rw-r--r-- | Towers/Assets/building_placement.png | bin | 0 -> 1068 bytes | |||
-rw-r--r-- | Towers/Assets/building_placement.png.import | 34 | ||||
-rw-r--r-- | Towers/Assets/building_placement.wav | bin | 0 -> 39250 bytes | |||
-rw-r--r-- | Towers/Assets/building_placement.wav.import | 24 | ||||
-rw-r--r-- | Towers/Assets/spritesheet.png | bin | 0 -> 4971 bytes | |||
-rw-r--r-- | Towers/Assets/spritesheet.png.import | 34 | ||||
-rw-r--r-- | Towers/Assets/spritesheet.png~ | bin | 0 -> 2853 bytes | |||
-rw-r--r-- | Towers/Components/BurnComponent.gd | 1 | ||||
-rw-r--r-- | Towers/Components/FrostComponent.gd | 1 | ||||
-rw-r--r-- | Towers/Components/TowerComponent.gd | 26 | ||||
-rw-r--r-- | Towers/PlacementParticles.tscn | 87 | ||||
-rw-r--r-- | Towers/Tower.gd | 155 | ||||
-rw-r--r-- | Towers/Tower.tscn | 154 | ||||
-rw-r--r-- | Towers/placement_particles.gd | 16 |
15 files changed, 315 insertions, 217 deletions
diff --git a/Towers/Assets/.spritesheet.png-autosave.kra b/Towers/Assets/.spritesheet.png-autosave.kra Binary files differnew file mode 100644 index 0000000..0f3888a --- /dev/null +++ b/Towers/Assets/.spritesheet.png-autosave.kra diff --git a/Towers/Assets/building_placement.png b/Towers/Assets/building_placement.png Binary files differnew file mode 100644 index 0000000..002c22f --- /dev/null +++ b/Towers/Assets/building_placement.png diff --git a/Towers/Assets/building_placement.png.import b/Towers/Assets/building_placement.png.import new file mode 100644 index 0000000..2ee31b6 --- /dev/null +++ b/Towers/Assets/building_placement.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://jh1wdkkilude" +path="res://.godot/imported/building_placement.png-6c7c9596746ac027a79e9e4fc0bf36b9.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Towers/Assets/building_placement.png" +dest_files=["res://.godot/imported/building_placement.png-6c7c9596746ac027a79e9e4fc0bf36b9.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Towers/Assets/building_placement.wav b/Towers/Assets/building_placement.wav Binary files differnew file mode 100644 index 0000000..1b31275 --- /dev/null +++ b/Towers/Assets/building_placement.wav diff --git a/Towers/Assets/building_placement.wav.import b/Towers/Assets/building_placement.wav.import new file mode 100644 index 0000000..c2f88c3 --- /dev/null +++ b/Towers/Assets/building_placement.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://bxpt1ooqt2mbg" +path="res://.godot/imported/building_placement.wav-f7670452d4e7e1606b49dd31cc052a43.sample" + +[deps] + +source_file="res://Towers/Assets/building_placement.wav" +dest_files=["res://.godot/imported/building_placement.wav-f7670452d4e7e1606b49dd31cc052a43.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/Towers/Assets/spritesheet.png b/Towers/Assets/spritesheet.png Binary files differnew file mode 100644 index 0000000..a890df3 --- /dev/null +++ b/Towers/Assets/spritesheet.png diff --git a/Towers/Assets/spritesheet.png.import b/Towers/Assets/spritesheet.png.import new file mode 100644 index 0000000..0617130 --- /dev/null +++ b/Towers/Assets/spritesheet.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dujcs2ls3u6tj" +path="res://.godot/imported/spritesheet.png-59ae34e5ef3cad1198464f683476d447.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Towers/Assets/spritesheet.png" +dest_files=["res://.godot/imported/spritesheet.png-59ae34e5ef3cad1198464f683476d447.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Towers/Assets/spritesheet.png~ b/Towers/Assets/spritesheet.png~ Binary files differnew file mode 100644 index 0000000..b473edb --- /dev/null +++ b/Towers/Assets/spritesheet.png~ diff --git a/Towers/Components/BurnComponent.gd b/Towers/Components/BurnComponent.gd index 11e9e3f..96c24f7 100644 --- a/Towers/Components/BurnComponent.gd +++ b/Towers/Components/BurnComponent.gd @@ -8,4 +8,5 @@ func _init() -> void: func on_shoot(target: Unit): var effect = preload("res://Effects/BurnEffect.tscn").instantiate() + effect.level = level target.add_effect(effect) diff --git a/Towers/Components/FrostComponent.gd b/Towers/Components/FrostComponent.gd index d6384a7..473baf6 100644 --- a/Towers/Components/FrostComponent.gd +++ b/Towers/Components/FrostComponent.gd @@ -8,4 +8,5 @@ func _init() -> void: func on_shoot(target: Unit): var effect = preload("res://Effects/SlowEffect.tscn").instantiate() + effect.level = level target.add_effect(effect) diff --git a/Towers/Components/TowerComponent.gd b/Towers/Components/TowerComponent.gd index 570b442..83fdc38 100644 --- a/Towers/Components/TowerComponent.gd +++ b/Towers/Components/TowerComponent.gd @@ -4,6 +4,7 @@ extends Resource var name: String var sprite: Sprite2D = Sprite2D.new() +var level: int = 1 func set_sprite(texture: Texture2D): @@ -13,3 +14,28 @@ func set_sprite(texture: Texture2D): sprite.centered = false sprite.scale = Vector2(2, 2) sprite.name = name + + + +class NetworkData extends Resource: + var name: String + var level: int + +func to_network_data() -> NetworkData: + var data = NetworkData.new() + + data.name = name + data.level = level + + return data + +func update_with_network_data(data: NetworkData): + pass + +static func from_network_data(data: NetworkData) -> TowerComponent: + var component = preload("res://Towers/Components/TowerComponent.gd").new() + + component.name = data.name + component.level = data.level + + return component diff --git a/Towers/PlacementParticles.tscn b/Towers/PlacementParticles.tscn new file mode 100644 index 0000000..d70768d --- /dev/null +++ b/Towers/PlacementParticles.tscn @@ -0,0 +1,87 @@ +[gd_scene load_steps=13 format=3 uid="uid://dkt08nmsm7v6n"] + +[ext_resource type="Script" path="res://Towers/placement_particles.gd" id="1_jyqtu"] +[ext_resource type="Texture2D" uid="uid://jh1wdkkilude" path="res://Towers/Assets/building_placement.png" id="2_84hoe"] +[ext_resource type="AudioStream" uid="uid://bxpt1ooqt2mbg" path="res://Towers/Assets/building_placement.wav" id="3_0cdk8"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_sn1sp"] +atlas = ExtResource("2_84hoe") +region = Rect2(0, 0, 49, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_fdlli"] +atlas = ExtResource("2_84hoe") +region = Rect2(49, 0, 49, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_3snmp"] +atlas = ExtResource("2_84hoe") +region = Rect2(98, 0, 49, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_cc8qd"] +atlas = ExtResource("2_84hoe") +region = Rect2(147, 0, 49, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_58064"] +atlas = ExtResource("2_84hoe") +region = Rect2(196, 0, 49, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_6wgny"] +atlas = ExtResource("2_84hoe") +region = Rect2(245, 0, 49, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_d6eii"] +atlas = ExtResource("2_84hoe") +region = Rect2(294, 0, 49, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_p743g"] +atlas = ExtResource("2_84hoe") +region = Rect2(343, 0, 49, 32) + +[sub_resource type="SpriteFrames" id="SpriteFrames_d1lms"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_sn1sp") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_fdlli") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_3snmp") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_cc8qd") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_58064") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_6wgny") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_d6eii") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_p743g") +}], +"loop": false, +"name": &"default", +"speed": 28.0 +}] + +[node name="PlacementParticles" type="Node2D"] +script = ExtResource("1_jyqtu") + +[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] +texture_filter = 1 +position = Vector2(-24, -16) +sprite_frames = SubResource("SpriteFrames_d1lms") + +[node name="AnimatedSprite2D2" type="AnimatedSprite2D" parent="."] +texture_filter = 1 +position = Vector2(24, -16) +sprite_frames = SubResource("SpriteFrames_d1lms") +flip_h = true + +[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] +stream = ExtResource("3_0cdk8") +volume_db = -16.0 diff --git a/Towers/Tower.gd b/Towers/Tower.gd index 8acdf38..2634966 100644 --- a/Towers/Tower.gd +++ b/Towers/Tower.gd @@ -5,6 +5,8 @@ extends StaticBody2D signal selected signal deselected +signal selected_secondary + static var selected_towers: Array[Tower] static var hovered_tower: Tower @@ -52,12 +54,18 @@ signal selection_group_id_changed(previous_id: String) # rpc owner id @export var owner_id = 1 -signal attack_value_changed(value: int) -@export var attack_range: int = 32 +@export var attack_range: int = 32: + set(value): + attack_range = value + $Range/CollisionShape2D.shape.radius = attack_range + @export var attack_power: int = 1 -@export var attack_speed: int = 1 -var speed_base: float = 2.0 +var attack_speed_base: float = 2.0 +@export var attack_speed: int = 1: + set(value): + attack_speed = value + %ShootCooldown.wait_time = attack_speed_base / attack_speed signal components_changed @export var components: Array[TowerComponent] = [] @@ -68,14 +76,7 @@ func _init(): func _ready(): - $Range/CollisionShape2D.shape.radius = attack_range - $ShootCooldown.wait_time = speed_base / attack_speed - - %Data.text = "Range: %s - Power: %s - Speed: %s" % [ - attack_range, attack_power, attack_speed - ] - - %HUD.visible = false + $AnimatedSprite2D.play() redraw_components() components_changed.connect(func(): @@ -101,9 +102,9 @@ func _draw(): modulate = Color(1.5, 1.5, 1.5) if is_highlighted: - var sprite_size = $Sprite2D.get_rect().size + var sprite_size = $AnimatedSprite2D.sprite_frames.get_frame_texture("default", 0).get_size() * $AnimatedSprite2D.scale draw_rect( - Rect2($Sprite2D.position, sprite_size), + Rect2($AnimatedSprite2D.position, sprite_size), Color(1, 1, 1, 1.0), false, 2.0 / get_viewport().get_camera_2d().zoom.x @@ -128,6 +129,9 @@ func _on_input_event(_viewport: Node, event: InputEvent, _shape_idx: int): if owner_id != multiplayer.get_unique_id(): return + if event.is_action_pressed("select_secondary"): + selected_secondary.emit() + if Client.state is StateBuild: if event.is_action_pressed("builder_cancel"): Client.remove_tower(self) @@ -146,7 +150,7 @@ func _on_selectable_area_hover_enter() -> void: func _on_selectable_area_hover_exit() -> void: is_hovered = false -func _on_selectable_area_select(event: InputEvent) -> void: +func _on_selectable_area_select_primary(event: InputEvent) -> void: # disable remote select for now if owner_id != multiplayer.get_unique_id(): return @@ -178,14 +182,10 @@ func remove_component(component_name: String): components_changed.emit() func redraw_components(): - for node in %Components.get_children(): - node.modulate = Color(1.0, 1.0, 1.0, 0.5) - for idx in range(components.size()): var component = components[idx] var sprite = $ComponentsAnchor.get_node(NodePath(component.name)) sprite.position.y = (idx + 1) * -16 - %Components.get_node(component.name).modulate = Color(1.0, 1.0, 1.0, 1.0) func is_melee_range(): @@ -209,13 +209,6 @@ func shoot(): target.set_hp(target.hp - 1) -func get_hud(): - var data = %HUD.get_child(0).duplicate() - data.name = name - - return data - - func get_region(): var collision_shape := $CollisionShape2D var shape = $CollisionShape2D.shape as RectangleShape2D @@ -235,6 +228,7 @@ func get_group_id() -> String: for component in components: string += component.name + string += str(component.level) return string.md5_text() @@ -243,102 +237,6 @@ func _on_tree_exiting() -> void: is_selected = false -func _on_h_box_container_gui_input(event: InputEvent) -> void: # TODO: money cost - # TODO: upgradeable - if event.is_action_pressed("select"): - get_viewport().set_input_as_handled() - - var hud: HUD = Client.current_stage.get_node("HUD") - var towers = hud.selection_groups[hud.selected_group].duplicate() - for tower: Tower in towers: - var found = false - for idx in range(tower.components.size()): - var component = tower.components[idx] - if component.name == "Frost": - found = true - tower.remove_component(component.name) - break - - if not found: - tower.add_component(preload("res://Towers/Components/FrostComponent.gd").new()) - - Client.update_tower(tower.get_path(), tower.to_network_data()) - - -func _on_h_box_container_2_gui_input(event: InputEvent) -> void: - if event.is_action_pressed("select"): - get_viewport().set_input_as_handled() - - var hud: HUD = Client.current_stage.get_node("HUD") - var towers = hud.selection_groups[hud.selected_group].duplicate() - for tower: Tower in towers: - var found = false - for idx in range(tower.components.size()): - var component = tower.components[idx] - if component.name == "Burn": - found = true - tower.remove_component(component.name) - break - - if not found: - tower.add_component(preload("res://Towers/Components/BurnComponent.gd").new()) - - Client.update_tower(tower.get_path(), tower.to_network_data()) - - -func _on_button_1_pressed() -> void: - var hud: HUD = Client.current_stage.get_node("HUD") - var towers = hud.selection_groups[hud.selected_group].duplicate() - - if Client.player.money < (attack_range / 8.0) * 10 * towers.size(): - return - - for tower: Tower in towers: - tower.attack_range += 8 - tower.attack_value_changed.emit((attack_range / 8.0) - 1) - tower.get_node("%Data").text = "Range: %s - Power: %s - Speed: %s" % [ - tower.attack_range, tower.attack_power, tower.attack_speed - ] - tower.get_node("%Range/CollisionShape2D").shape.radius = attack_range - tower.selection_group_id = tower.get_group_id() - Client.update_tower(tower.get_path(), tower.to_network_data()) - - -func _on_button_2_pressed() -> void: - var hud: HUD = Client.current_stage.get_node("HUD") - var towers = hud.selection_groups[hud.selected_group].duplicate() - - if Client.player.money < attack_power * 10 * towers.size(): - return - - for tower: Tower in towers: - tower.attack_power += 1 - tower.attack_value_changed.emit(attack_power - 1) - tower.get_node("%Data").text = "Range: %s - Power: %s - Speed: %s" % [ - tower.attack_range, tower.attack_power, tower.attack_speed - ] - tower.selection_group_id = tower.get_group_id() - Client.update_tower(tower.get_path(), tower.to_network_data()) - - -func _on_button_3_pressed() -> void: - var hud: HUD = Client.current_stage.get_node("HUD") - var towers = hud.selection_groups[hud.selected_group].duplicate() - - if Client.player.money < attack_speed * 10 * towers.size(): - return - - for tower: Tower in towers: - tower.attack_speed += 1 - tower.attack_value_changed.emit(attack_speed - 1) - tower.get_node("%Data").text = "Range: %s - Power: %s - Speed: %s" % [ - tower.attack_range, tower.attack_power, tower.attack_speed - ] - tower.get_node("%ShootCooldown").wait_time = (speed_base / attack_speed) - tower.selection_group_id = tower.get_group_id() - Client.update_tower(tower.get_path(), tower.to_network_data()) - - class NetworkData extends Resource: var name: String @@ -364,10 +262,10 @@ func to_network_data() -> NetworkData: data.attack_power = attack_power data.attack_speed = attack_speed data.components = components.map(func(item: TowerComponent): - return item.name + return inst_to_dict(item.to_network_data()) ) - data.sprite_modulate = $Sprite2D.modulate + data.sprite_modulate = $AnimatedSprite2D.modulate data.components_anchor_modulate = $ComponentsAnchor.modulate # IMPROVEMENT: check against last update and only set changed values @@ -378,10 +276,11 @@ func update_with_network_data(data: NetworkData): for component in components.duplicate(): remove_component(component.name) - for component_name in data.components: - add_component( - load("res://Towers/Components/" + component_name + "Component.gd").new() - ) + for component_data in data.components: + var component_network_data: TowerComponent.NetworkData = dict_to_inst(component_data) + var component = load("res://Towers/Components/" + component_network_data.name + "Component.gd").new() + component.level = component_network_data.level + add_component(component) static func from_network_data(data: NetworkData) -> Tower: var tower: Tower = preload("res://Towers/Tower.tscn").instantiate() diff --git a/Towers/Tower.tscn b/Towers/Tower.tscn index 792c41a..13bbe72 100644 --- a/Towers/Tower.tscn +++ b/Towers/Tower.tscn @@ -1,10 +1,59 @@ -[gd_scene load_steps=10 format=3 uid="uid://by1x56w21o165"] +[gd_scene load_steps=15 format=3 uid="uid://by1x56w21o165"] [ext_resource type="Script" path="res://Towers/Tower.gd" id="1_axo1d"] [ext_resource type="Texture2D" uid="uid://b1b18rd0tqbar" path="res://core_outdoor.png" id="1_mrep8"] [ext_resource type="PackedScene" uid="uid://cqktpc8c7ecn3" path="res://Game/Selection/SelectableArea.tscn" id="3_57d5u"] -[ext_resource type="Texture2D" uid="uid://ba3dmlce1wv2p" path="res://Towers/Components/Assets/frost-component.png" id="4_ccrqc"] -[ext_resource type="Texture2D" uid="uid://2djpswd6sgng" path="res://Towers/Components/Assets/burn-component.png" id="5_y7tf5"] +[ext_resource type="Texture2D" uid="uid://dujcs2ls3u6tj" path="res://Towers/Assets/spritesheet.png" id="3_brkps"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_1ubf7"] +atlas = ExtResource("3_brkps") +region = Rect2(0, 0, 70, 96) + +[sub_resource type="AtlasTexture" id="AtlasTexture_5lmyn"] +atlas = ExtResource("3_brkps") +region = Rect2(70, 0, 70, 96) + +[sub_resource type="AtlasTexture" id="AtlasTexture_rpcx3"] +atlas = ExtResource("3_brkps") +region = Rect2(140, 0, 70, 96) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ds0p3"] +atlas = ExtResource("3_brkps") +region = Rect2(210, 0, 70, 96) + +[sub_resource type="AtlasTexture" id="AtlasTexture_j7nj3"] +atlas = ExtResource("3_brkps") +region = Rect2(280, 0, 70, 96) + +[sub_resource type="AtlasTexture" id="AtlasTexture_lklxx"] +atlas = ExtResource("3_brkps") +region = Rect2(350, 0, 70, 96) + +[sub_resource type="SpriteFrames" id="SpriteFrames_cd6hj"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_1ubf7") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_5lmyn") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_rpcx3") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ds0p3") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_j7nj3") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_lklxx") +}], +"loop": true, +"name": &"default", +"speed": 5.0 +}] [sub_resource type="RectangleShape2D" id="RectangleShape2D_atm5x"] size = Vector2(31, 31) @@ -14,23 +63,6 @@ size = Vector2(31, 31) [sub_resource type="RectangleShape2D" id="RectangleShape2D_312i7"] size = Vector2(32, 32) -[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_spp26"] -properties/0/path = NodePath(".:position") -properties/0/spawn = true -properties/0/replication_mode = 0 -properties/1/path = NodePath(".:owner_id") -properties/1/spawn = true -properties/1/replication_mode = 0 -properties/2/path = NodePath(".:attack_range") -properties/2/spawn = true -properties/2/replication_mode = 2 -properties/3/path = NodePath("Sprite2D:modulate") -properties/3/spawn = true -properties/3/replication_mode = 0 -properties/4/path = NodePath("ComponentsAnchor:modulate") -properties/4/spawn = true -properties/4/replication_mode = 0 - [node name="Tower" type="StaticBody2D"] collision_layer = 4 collision_mask = 5 @@ -38,14 +70,22 @@ input_pickable = true script = ExtResource("1_axo1d") [node name="Sprite2D" type="Sprite2D" parent="."] +visible = false texture_filter = 1 -position = Vector2(0, -19) -scale = Vector2(1.0625, 1.0625) +position = Vector2(0, -11) texture = ExtResource("1_mrep8") centered = false region_enabled = true region_rect = Rect2(400, 439, 32, 41) +[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] +texture_filter = 1 +position = Vector2(0, -12) +scale = Vector2(0.457143, 0.457143) +sprite_frames = SubResource("SpriteFrames_cd6hj") +frame_progress = 0.499103 +centered = false + [node name="CollisionShape2D" type="CollisionShape2D" parent="."] position = Vector2(16, 16) shape = SubResource("RectangleShape2D_atm5x") @@ -71,67 +111,8 @@ shape = SubResource("RectangleShape2D_312i7") [node name="ComponentsAnchor" type="Marker2D" parent="."] position = Vector2(0, 32) -[node name="HUD" type="CanvasLayer" parent="."] -unique_name_in_owner = true - -[node name="VBoxContainer" type="VBoxContainer" parent="HUD"] -offset_left = 64.0 -offset_right = 140.0 -offset_bottom = 77.0 - -[node name="Data" type="Label" parent="HUD/VBoxContainer"] -unique_name_in_owner = true -layout_mode = 2 - -[node name="HBoxContainer" type="HBoxContainer" parent="HUD/VBoxContainer"] -layout_mode = 2 - -[node name="Button1" type="Button" parent="HUD/VBoxContainer/HBoxContainer"] -layout_mode = 2 -text = "+Range" - -[node name="Button2" type="Button" parent="HUD/VBoxContainer/HBoxContainer"] -layout_mode = 2 -text = "+Power" - -[node name="Button3" type="Button" parent="HUD/VBoxContainer/HBoxContainer"] -layout_mode = 2 -text = "+Speed" - -[node name="Components" type="VBoxContainer" parent="HUD/VBoxContainer"] -unique_name_in_owner = true -layout_mode = 2 - -[node name="Frost" type="HBoxContainer" parent="HUD/VBoxContainer/Components"] -layout_mode = 2 -mouse_default_cursor_shape = 2 - -[node name="TextureRect" type="TextureRect" parent="HUD/VBoxContainer/Components/Frost"] -custom_minimum_size = Vector2(32, 0) -layout_mode = 2 -texture = ExtResource("4_ccrqc") -stretch_mode = 5 - -[node name="Label" type="Label" parent="HUD/VBoxContainer/Components/Frost"] -layout_mode = 2 -text = "Frost" - -[node name="Burn" type="HBoxContainer" parent="HUD/VBoxContainer/Components"] -layout_mode = 2 -mouse_default_cursor_shape = 2 - -[node name="TextureRect" type="TextureRect" parent="HUD/VBoxContainer/Components/Burn"] -custom_minimum_size = Vector2(32, 0) -layout_mode = 2 -texture = ExtResource("5_y7tf5") -stretch_mode = 5 - -[node name="Label" type="Label" parent="HUD/VBoxContainer/Components/Burn"] -layout_mode = 2 -text = "Burn" - -[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."] -replication_config = SubResource("SceneReplicationConfig_spp26") +[node name="GroundAnchor" type="Marker2D" parent="."] +position = Vector2(16, 29) [connection signal="input_event" from="." to="." method="_on_input_event"] [connection signal="tree_exiting" from="." to="." method="_on_tree_exiting"] @@ -139,9 +120,4 @@ replication_config = SubResource("SceneReplicationConfig_spp26") [connection signal="body_exited" from="Range" to="." method="_on_range_body_exited"] [connection signal="hover_enter" from="SelectableArea" to="." method="_on_selectable_area_hover_enter"] [connection signal="hover_exit" from="SelectableArea" to="." method="_on_selectable_area_hover_exit"] -[connection signal="select" from="SelectableArea" to="." method="_on_selectable_area_select"] -[connection signal="pressed" from="HUD/VBoxContainer/HBoxContainer/Button1" to="." method="_on_button_1_pressed"] -[connection signal="pressed" from="HUD/VBoxContainer/HBoxContainer/Button2" to="." method="_on_button_2_pressed"] -[connection signal="pressed" from="HUD/VBoxContainer/HBoxContainer/Button3" to="." method="_on_button_3_pressed"] -[connection signal="gui_input" from="HUD/VBoxContainer/Components/Frost" to="." method="_on_h_box_container_gui_input"] -[connection signal="gui_input" from="HUD/VBoxContainer/Components/Burn" to="." method="_on_h_box_container_2_gui_input"] +[connection signal="select_primary" from="SelectableArea" to="." method="_on_selectable_area_select_primary"] diff --git a/Towers/placement_particles.gd b/Towers/placement_particles.gd new file mode 100644 index 0000000..72099c5 --- /dev/null +++ b/Towers/placement_particles.gd @@ -0,0 +1,16 @@ +extends Node2D + + +@export var play_sound := false + + +func _ready() -> void: + $AnimatedSprite2D.animation_finished.connect(func(): + queue_free() + ) + + if play_sound: + $AudioStreamPlayer.play() + + $AnimatedSprite2D.play() + $AnimatedSprite2D2.play() |