Mortar first act
BIN
Assets/Bullets/mortarbullet (1).png
Normal file
After Width: | Height: | Size: 4.3 KiB |
34
Assets/Bullets/mortarbullet (1).png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://t8y1d33eiffp"
|
||||
path="res://.godot/imported/mortarbullet (1).png-bd02e86efaecc04294db5598a8ff4941.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Bullets/mortarbullet (1).png"
|
||||
dest_files=["res://.godot/imported/mortarbullet (1).png-bd02e86efaecc04294db5598a8ff4941.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
|
BIN
Assets/Bullets/mortarbullet (2).png
Normal file
After Width: | Height: | Size: 1.9 KiB |
34
Assets/Bullets/mortarbullet (2).png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cinql8footbvf"
|
||||
path="res://.godot/imported/mortarbullet (2).png-279c67fc247930242862398e474b1704.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Bullets/mortarbullet (2).png"
|
||||
dest_files=["res://.godot/imported/mortarbullet (2).png-279c67fc247930242862398e474b1704.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
|
BIN
Assets/Bullets/mortarbullet (3).png
Normal file
After Width: | Height: | Size: 2.1 KiB |
34
Assets/Bullets/mortarbullet (3).png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://xm4gs3h00bk1"
|
||||
path="res://.godot/imported/mortarbullet (3).png-b329690a914caf9dc9888e2b8b46ac5b.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Bullets/mortarbullet (3).png"
|
||||
dest_files=["res://.godot/imported/mortarbullet (3).png-b329690a914caf9dc9888e2b8b46ac5b.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
|
BIN
Assets/Bullets/mortarbullet (4).png
Normal file
After Width: | Height: | Size: 2.2 KiB |
34
Assets/Bullets/mortarbullet (4).png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://crf32to6tlkux"
|
||||
path="res://.godot/imported/mortarbullet (4).png-e0733a13433f6ad1bf2aa3d1f51d809f.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Bullets/mortarbullet (4).png"
|
||||
dest_files=["res://.godot/imported/mortarbullet (4).png-e0733a13433f6ad1bf2aa3d1f51d809f.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
|
BIN
Assets/Bullets/mortarbullet (5).png
Normal file
After Width: | Height: | Size: 2.0 KiB |
34
Assets/Bullets/mortarbullet (5).png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bbu8u4h7vpqwa"
|
||||
path="res://.godot/imported/mortarbullet (5).png-b2738216fc7e80dd313006814419ed57.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Bullets/mortarbullet (5).png"
|
||||
dest_files=["res://.godot/imported/mortarbullet (5).png-b2738216fc7e80dd313006814419ed57.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
|
BIN
Assets/Bullets/mortarbullet (6).png
Normal file
After Width: | Height: | Size: 1011 B |
34
Assets/Bullets/mortarbullet (6).png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://uc2ib201l7kd"
|
||||
path="res://.godot/imported/mortarbullet (6).png-bdeb165e64ca987fc7c17fa91fd2e302.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Bullets/mortarbullet (6).png"
|
||||
dest_files=["res://.godot/imported/mortarbullet (6).png-bdeb165e64ca987fc7c17fa91fd2e302.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
|
BIN
Assets/Towers/Mortar part (1).png
Normal file
After Width: | Height: | Size: 4.9 KiB |
34
Assets/Towers/Mortar part (1).png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cxtluaplpd8hg"
|
||||
path="res://.godot/imported/Mortar part (1).png-e606caec3a4a5ae944b12a924ac46cc9.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Towers/Mortar part (1).png"
|
||||
dest_files=["res://.godot/imported/Mortar part (1).png-e606caec3a4a5ae944b12a924ac46cc9.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
|
BIN
Assets/Towers/Mortar part (2).png
Normal file
After Width: | Height: | Size: 16 KiB |
34
Assets/Towers/Mortar part (2).png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cm33n3xc81rpj"
|
||||
path="res://.godot/imported/Mortar part (2).png-9f620b42d0e77bf9811134e9147444fa.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Towers/Mortar part (2).png"
|
||||
dest_files=["res://.godot/imported/Mortar part (2).png-9f620b42d0e77bf9811134e9147444fa.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
|
BIN
Assets/Towers/Mortar part (3).png
Normal file
After Width: | Height: | Size: 3.4 KiB |
34
Assets/Towers/Mortar part (3).png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dkgih7tl654v1"
|
||||
path="res://.godot/imported/Mortar part (3).png-2df41141f9b4f6965bc7b31fab6c02f0.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Towers/Mortar part (3).png"
|
||||
dest_files=["res://.godot/imported/Mortar part (3).png-2df41141f9b4f6965bc7b31fab6c02f0.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
|
@ -5,6 +5,19 @@ var speed
|
||||
var hitpoint
|
||||
var distancetaken = 0
|
||||
|
||||
#For the mortar, to create a nice bezier curve!
|
||||
var starterpos = 0
|
||||
var targetpos = 0
|
||||
var midpoint = 0
|
||||
var t = 0.0
|
||||
var duration = 0.5
|
||||
|
||||
func _ready() -> void:
|
||||
starterpos = global_position
|
||||
targetpos = target.global_position
|
||||
midpoint = (targetpos + starterpos) / 2
|
||||
midpoint.y -= 200 #height of the curve!
|
||||
|
||||
func set_targe(_target : Node2D) -> void:
|
||||
target = _target
|
||||
|
||||
@ -14,8 +27,15 @@ func set_speed(_speed: int) -> void:
|
||||
func set_hitpoint(_hitpoint: int) -> void:
|
||||
hitpoint = _hitpoint
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if target and speed > 0:
|
||||
if name.contains("Rock"):
|
||||
t += delta / duration
|
||||
position = bezier(t)
|
||||
if t >= 1.0:
|
||||
get_node("CharacterBody2D/AnimatedSprite2D").play("hit")
|
||||
set_process(false)
|
||||
elif target and speed > 0:
|
||||
# Get the direction vector from the bullet to the target
|
||||
var direction = (target.get_parent().get_parent().get_position() - position).normalized()
|
||||
|
||||
@ -45,7 +65,16 @@ func target_reached() -> void:
|
||||
if randf() < 0.5:
|
||||
target.get_parent().set_progress(max(target.get_parent().get_progress() - 60, 0))
|
||||
|
||||
|
||||
|
||||
target.get_parent().enemy_hurt(hitpoint)
|
||||
queue_free()
|
||||
|
||||
|
||||
func bezier(t: float):
|
||||
var q0 = starterpos.lerp(midpoint, t)
|
||||
var q1 = midpoint.lerp(targetpos, t)
|
||||
return q0.lerp(q1, t)
|
||||
|
||||
|
||||
|
||||
func _on_animated_sprite_2d_animation_finished() -> void:
|
||||
queue_free()
|
||||
|
59
Game/Bullets/rock.tscn
Normal file
@ -0,0 +1,59 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://cwcgq1vk643ha"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dqvdgdobuo2rf" path="res://Game/Bullets/bullet.gd" id="1_yml18"]
|
||||
[ext_resource type="Texture2D" uid="uid://t8y1d33eiffp" path="res://Assets/Bullets/mortarbullet (1).png" id="2_yml18"]
|
||||
[ext_resource type="Texture2D" uid="uid://cinql8footbvf" path="res://Assets/Bullets/mortarbullet (2).png" id="3_tjven"]
|
||||
[ext_resource type="Texture2D" uid="uid://xm4gs3h00bk1" path="res://Assets/Bullets/mortarbullet (3).png" id="4_av0br"]
|
||||
[ext_resource type="Texture2D" uid="uid://crf32to6tlkux" path="res://Assets/Bullets/mortarbullet (4).png" id="5_c612l"]
|
||||
[ext_resource type="Texture2D" uid="uid://bbu8u4h7vpqwa" path="res://Assets/Bullets/mortarbullet (5).png" id="6_m5188"]
|
||||
[ext_resource type="Texture2D" uid="uid://uc2ib201l7kd" path="res://Assets/Bullets/mortarbullet (6).png" id="7_lr72h"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_yml18"]
|
||||
size = Vector2(18, 16)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_yml18"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("2_yml18")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 2.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("3_tjven")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("4_av0br")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("5_c612l")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("6_m5188")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("7_lr72h")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"hit",
|
||||
"speed": 8.0
|
||||
}]
|
||||
|
||||
[node name="Rock" type="Node2D"]
|
||||
script = ExtResource("1_yml18")
|
||||
|
||||
[node name="CharacterBody2D" type="CharacterBody2D" parent="."]
|
||||
collision_mask = 2
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D"]
|
||||
shape = SubResource("RectangleShape2D_yml18")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="CharacterBody2D"]
|
||||
scale = Vector2(0.4, 0.4)
|
||||
sprite_frames = SubResource("SpriteFrames_yml18")
|
||||
autoplay = "default"
|
||||
|
||||
[connection signal="animation_finished" from="CharacterBody2D/AnimatedSprite2D" to="." method="_on_animated_sprite_2d_animation_finished"]
|
48
Game/Towers/mortar_tower.tscn
Normal file
@ -0,0 +1,48 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://uqxd2lii1xba"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dil41a1ymo0ua" path="res://Game/Towers/towers.gd" id="1_bhlym"]
|
||||
[ext_resource type="Texture2D" uid="uid://dkgih7tl654v1" path="res://Assets/Towers/Mortar part (3).png" id="1_sq58r"]
|
||||
[ext_resource type="Texture2D" uid="uid://cm33n3xc81rpj" path="res://Assets/Towers/Mortar part (2).png" id="2_bhlym"]
|
||||
[ext_resource type="Texture2D" uid="uid://cxtluaplpd8hg" path="res://Assets/Towers/Mortar part (1).png" id="3_82ftk"]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_cfdf4"]
|
||||
radius = 29.0
|
||||
height = 88.0
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bhlym"]
|
||||
size = Vector2(367.125, 172.25)
|
||||
|
||||
[node name="MortarTower" type="Node2D"]
|
||||
script = ExtResource("1_bhlym")
|
||||
|
||||
[node name="CharacterBody2D" type="CharacterBody2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D"]
|
||||
position = Vector2(0, 17)
|
||||
shape = SubResource("CapsuleShape2D_cfdf4")
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="CharacterBody2D"]
|
||||
position = Vector2(2, 20)
|
||||
collision_mask = 2
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D/Area2D"]
|
||||
position = Vector2(-1, -68)
|
||||
shape = SubResource("RectangleShape2D_bhlym")
|
||||
|
||||
[node name="MortarPart(3)" type="Sprite2D" parent="CharacterBody2D"]
|
||||
position = Vector2(0.800001, 18.6)
|
||||
scale = Vector2(0.4, 0.4)
|
||||
texture = ExtResource("1_sq58r")
|
||||
|
||||
[node name="MortarPart(2)" type="Sprite2D" parent="CharacterBody2D"]
|
||||
position = Vector2(4.40004, 18)
|
||||
scale = Vector2(0.4, 0.4)
|
||||
texture = ExtResource("2_bhlym")
|
||||
|
||||
[node name="MortarPart(1)" type="Sprite2D" parent="CharacterBody2D"]
|
||||
position = Vector2(0.800001, 31.6)
|
||||
scale = Vector2(0.4, 0.4)
|
||||
texture = ExtResource("3_82ftk")
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
autostart = true
|
@ -9,10 +9,11 @@ var target = null
|
||||
|
||||
const ARROW = preload("res://Game/Bullets/arrow.tscn")
|
||||
const MAGIC = preload("res://Game/Bullets/magic.tscn")
|
||||
const ROCK = preload("res://Game/Bullets/rock.tscn")
|
||||
|
||||
func _ready() -> void:
|
||||
follower = true
|
||||
get_node("CharacterBody2D/Area2D").connect("body_entered", Callable(self, "choose_target"))
|
||||
get_node("CharacterBody2D/Area2D").body_entered.connect(choose_target)
|
||||
get_node("Timer").timeout.connect(shoot)
|
||||
set_process_input(true)
|
||||
set_properties()
|
||||
@ -33,6 +34,9 @@ func set_properties() -> void:
|
||||
get_node("Timer").wait_time = 2.0
|
||||
bulletSpeed = 450
|
||||
hitpoint = 10
|
||||
if self.name.contains("MortarTower"): #??? not sure if necessary yet
|
||||
get_node("Timer").wait_time = 5
|
||||
hitpoint = 10
|
||||
|
||||
func get_if_moving_state():
|
||||
return follower
|
||||
@ -46,11 +50,11 @@ func choose_target(body : Node2D) -> void:
|
||||
if not follower:
|
||||
var surroinding_enemies = get_node("CharacterBody2D/Area2D").get_overlapping_bodies()
|
||||
target = surroinding_enemies[0]
|
||||
if self.name.contains("ArcherTower") or self.name.contains("BombTower"):
|
||||
if self.name.contains("ArcherTower"):
|
||||
for i in surroinding_enemies:
|
||||
if i.get_parent().get_progress() > target.get_parent().get_progress():
|
||||
target = i
|
||||
if self.name.contains("WizardTower"):
|
||||
if self.name.contains("WizardTower") or self.name.contains("MortarTower"):
|
||||
for i in surroinding_enemies:
|
||||
if i.get_parent().get_progress() < target.get_parent().get_progress():
|
||||
target = i
|
||||
@ -60,6 +64,7 @@ func shoot() -> void:
|
||||
if target != null:
|
||||
if self.name.contains("ArcherTower"):
|
||||
var arrow = ARROW.instantiate()
|
||||
arrow.name = "Arrow" + str(randi())
|
||||
arrow.position = self.position
|
||||
arrow.set_speed(bulletSpeed)
|
||||
arrow.set_targe(target)
|
||||
@ -68,9 +73,20 @@ func shoot() -> void:
|
||||
|
||||
if self.name.contains("WizardTower"):
|
||||
var magic = MAGIC.instantiate()
|
||||
magic.name = "Magic" + str(randi())
|
||||
magic.position = self.position
|
||||
magic.set_speed(bulletSpeed)
|
||||
magic.set_targe(target)
|
||||
magic.set_hitpoint(hitpoint)
|
||||
get_parent().add_child(magic)
|
||||
|
||||
if self.name.contains("MortarTower"):
|
||||
var rock = ROCK.instantiate()
|
||||
rock.name = "Rock" + str(randi())
|
||||
rock.position = self.position
|
||||
rock.set_speed(bulletSpeed)
|
||||
rock.set_targe(target)
|
||||
rock.set_hitpoint(hitpoint)
|
||||
get_parent().add_child(rock)
|
||||
|
||||
pass
|
||||
|
@ -17,6 +17,8 @@ const ARCHER_TOWER = preload("res://Game/Towers/archer_tower.tscn")
|
||||
@onready var wizardtowerspawn: Button = $HBoxContainer4/HBoxContainer2/Button3
|
||||
const WIZARD_TOWER = preload("res://Game/Towers/wizard_tower.tscn")
|
||||
|
||||
@onready var mortartowerspawn: Button = $HBoxContainer4/HBoxContainer2/Button4
|
||||
const MORTAR_TOWER = preload("res://Game/Towers/mortar_tower.tscn")
|
||||
|
||||
@onready var delete_tower_button: Button = $HBoxContainer4/HBoxContainer5/Button4
|
||||
const DELETER = preload("res://Game/Accesories/deleter.tscn")
|
||||
@ -29,6 +31,7 @@ func _ready() -> void:
|
||||
wallspawner.connect("button_down", Spawn_Wall)
|
||||
archertowerspawn.connect("button_up", Spawn_Archer)
|
||||
wizardtowerspawn.connect("button_up", Spawn_wizard)
|
||||
mortartowerspawn.connect("button_up", Spawn_Mortar)
|
||||
delete_tower_button.connect("button_up", Spawn_Deleter)
|
||||
|
||||
func set_Lifes(amount) -> void:
|
||||
@ -72,6 +75,12 @@ func Spawn_wizard() -> void:
|
||||
get_parent().add_child(tower)
|
||||
pass
|
||||
|
||||
func Spawn_Mortar() -> void:
|
||||
var tower = MORTAR_TOWER.instantiate()
|
||||
tower.name = "MortarTower-" + str(randi())
|
||||
get_parent().add_child(tower)
|
||||
pass
|
||||
|
||||
func Spawn_Deleter() -> void:
|
||||
var deleter = DELETER.instantiate()
|
||||
get_parent().add_child(deleter)
|
||||
|