diff options
Diffstat (limited to 'Towers/Components')
-rw-r--r-- | Towers/Components/Assets/poison-component.png | bin | 0 -> 176 bytes | |||
-rw-r--r-- | Towers/Components/Assets/poison-component.png.import | 34 | ||||
-rw-r--r-- | Towers/Components/BurnComponent.tscn | 2 | ||||
-rw-r--r-- | Towers/Components/PoisonComponent.gd | 7 | ||||
-rw-r--r-- | Towers/Components/PoisonComponent.tscn | 12 | ||||
-rw-r--r-- | Towers/Components/TowerComponent.gd | 4 |
6 files changed, 57 insertions, 2 deletions
diff --git a/Towers/Components/Assets/poison-component.png b/Towers/Components/Assets/poison-component.png Binary files differnew file mode 100644 index 0000000..76f561d --- /dev/null +++ b/Towers/Components/Assets/poison-component.png diff --git a/Towers/Components/Assets/poison-component.png.import b/Towers/Components/Assets/poison-component.png.import new file mode 100644 index 0000000..8a1c383 --- /dev/null +++ b/Towers/Components/Assets/poison-component.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://rkeldjv41ww8" +path="res://.godot/imported/poison-component.png-83d1bbb149be90a9cdae02ce5657d8f9.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Towers/Components/Assets/poison-component.png" +dest_files=["res://.godot/imported/poison-component.png-83d1bbb149be90a9cdae02ce5657d8f9.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/Components/BurnComponent.tscn b/Towers/Components/BurnComponent.tscn index 285cfa0..11e65ff 100644 --- a/Towers/Components/BurnComponent.tscn +++ b/Towers/Components/BurnComponent.tscn @@ -4,7 +4,7 @@ [ext_resource type="Script" path="res://Towers/Components/BurnComponent.gd" id="2_nevgj"] [ext_resource type="Texture2D" uid="uid://2djpswd6sgng" path="res://Towers/Components/Assets/burn-component.png" id="3_o6seh"] -[node name="TowerComponent" instance=ExtResource("1_56lm4")] +[node name="BurnTowerComponent" instance=ExtResource("1_56lm4")] script = ExtResource("2_nevgj") type = 4 diff --git a/Towers/Components/PoisonComponent.gd b/Towers/Components/PoisonComponent.gd new file mode 100644 index 0000000..77ee4fb --- /dev/null +++ b/Towers/Components/PoisonComponent.gd @@ -0,0 +1,7 @@ +extends TowerComponent + + +func on_shoot(target: Unit): + var effect = preload("res://Effects/PoisonEffect.tscn").instantiate() + effect.level = level + target.add_effect(effect) diff --git a/Towers/Components/PoisonComponent.tscn b/Towers/Components/PoisonComponent.tscn new file mode 100644 index 0000000..9e6b21e --- /dev/null +++ b/Towers/Components/PoisonComponent.tscn @@ -0,0 +1,12 @@ +[gd_scene load_steps=4 format=3 uid="uid://bx1bi1ko6tyqq"] + +[ext_resource type="PackedScene" uid="uid://cly4agfoqhq2q" path="res://Towers/Components/TowerComponent.tscn" id="1_euxd5"] +[ext_resource type="Script" path="res://Towers/Components/PoisonComponent.gd" id="2_dnmjy"] +[ext_resource type="Texture2D" uid="uid://rkeldjv41ww8" path="res://Towers/Components/Assets/poison-component.png" id="3_3hijl"] + +[node name="PoisonTowerComponent" instance=ExtResource("1_euxd5")] +script = ExtResource("2_dnmjy") +type = 5 + +[node name="Sprite" parent="." index="0"] +texture = ExtResource("3_3hijl") diff --git a/Towers/Components/TowerComponent.gd b/Towers/Components/TowerComponent.gd index 30b1c44..9a16845 100644 --- a/Towers/Components/TowerComponent.gd +++ b/Towers/Components/TowerComponent.gd @@ -66,7 +66,9 @@ func update_with_network_data(data: NetworkData): level = data.level static func from_network_data(data: NetworkData) -> TowerComponent: - var component = preload("res://Towers/Components/TowerComponent.gd").new() + var component = load( + "res://Towers/Components/%sComponent.tscn" % [ComponentType.keys()[data.type]] + ).instantiate() component.type = data.type component.level = data.level |