diff --git a/scripts/bullets/bullet_1.gd b/scripts/bullets/bullet_1.gd index 56b7d8d..242a7f3 100644 --- a/scripts/bullets/bullet_1.gd +++ b/scripts/bullets/bullet_1.gd @@ -2,9 +2,11 @@ extends Area2D const right = Vector2.RIGHT -var speed : int = 0 -var damage : int = 0 +var speed: int = 0 +var damage: int = 0 var dir = 0 +var area_damage: bool = false +var area_damage_target = [] func _physics_process(_delta): var move_dir = Vector2(1,0).rotated(dir) @@ -15,5 +17,9 @@ func _on_VisibilityNotifier2D_screen_exited(): func _on_Bullet_body_entered(body): if body.is_in_group("Enemy"): - body.get_parent().hit(damage) + if area_damage: + for enemy in area_damage_target: + enemy.hit(damage) + else: + body.get_parent().hit(damage) queue_free() diff --git a/scripts/stages/1/config.gd b/scripts/stages/1/config.gd index 0ede201..088f9d6 100644 --- a/scripts/stages/1/config.gd +++ b/scripts/stages/1/config.gd @@ -76,7 +76,8 @@ var tower = [ "speed": 3, "damage": 30, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false }, { "name": "Railgun", @@ -86,7 +87,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false }, { "name": "Cannon (V2)", @@ -96,7 +98,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false }, { "name": "Railgun (V2)", @@ -106,7 +109,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false }, { "name": "Cannon (V3)", @@ -116,7 +120,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": true }, { "name": "Railgun (V3)", @@ -126,7 +131,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false } ] diff --git a/scripts/stages/2/config.gd b/scripts/stages/2/config.gd index 0b875eb..b1a97b5 100644 --- a/scripts/stages/2/config.gd +++ b/scripts/stages/2/config.gd @@ -106,7 +106,8 @@ var tower = [ "speed": 3, "damage": 30, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false }, { "name": "Railgun", @@ -116,7 +117,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false }, { "name": "Cannon (V2)", @@ -126,7 +128,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false }, { "name": "Railgun (V2)", @@ -136,7 +139,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false }, { "name": "Cannon (V3)", @@ -146,7 +150,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": true }, { "name": "Railgun (V3)", @@ -156,7 +161,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false } ] diff --git a/scripts/stages/3/config.gd b/scripts/stages/3/config.gd index acb7738..4bcefe0 100644 --- a/scripts/stages/3/config.gd +++ b/scripts/stages/3/config.gd @@ -88,7 +88,8 @@ var tower = [ "speed": 3, "damage": 30, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false }, { "name": "Railgun", @@ -98,7 +99,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false }, { "name": "Cannon (V2)", @@ -108,7 +110,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false }, { "name": "Railgun (V2)", @@ -118,7 +121,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false }, { "name": "Cannon (V3)", @@ -128,7 +132,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": true }, { "name": "Railgun (V3)", @@ -138,7 +143,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false } ] diff --git a/scripts/stages/4/config.gd b/scripts/stages/4/config.gd index dea37f7..7231abc 100644 --- a/scripts/stages/4/config.gd +++ b/scripts/stages/4/config.gd @@ -94,7 +94,8 @@ var tower = [ "speed": 3, "damage": 30, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false }, { "name": "Railgun", @@ -104,7 +105,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false }, { "name": "Cannon (V2)", @@ -114,7 +116,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false }, { "name": "Railgun (V2)", @@ -124,7 +127,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false }, { "name": "Cannon (V3)", @@ -134,7 +138,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": true }, { "name": "Railgun (V3)", @@ -144,7 +149,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false } ] diff --git a/scripts/stages/5/config.gd b/scripts/stages/5/config.gd index 088d15f..c18946b 100644 --- a/scripts/stages/5/config.gd +++ b/scripts/stages/5/config.gd @@ -94,7 +94,8 @@ var tower = [ "speed": 3, "damage": 30, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false }, { "name": "Railgun", @@ -104,7 +105,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false }, { "name": "Cannon (V2)", @@ -114,7 +116,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false }, { "name": "Railgun (V2)", @@ -124,7 +127,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false }, { "name": "Cannon (V3)", @@ -134,7 +138,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": true }, { "name": "Railgun (V3)", @@ -144,7 +149,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false } ] diff --git a/scripts/stages/6/config.gd b/scripts/stages/6/config.gd index 91bb3ab..f1862eb 100644 --- a/scripts/stages/6/config.gd +++ b/scripts/stages/6/config.gd @@ -136,7 +136,8 @@ var tower = [ "speed": 3, "damage": 30, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": true }, { "name": "Railgun", @@ -146,7 +147,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false }, { "name": "Cannon (V2)", @@ -156,7 +158,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false }, { "name": "Railgun (V2)", @@ -166,7 +169,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false }, { "name": "Cannon (V3)", @@ -176,7 +180,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": true }, { "name": "Railgun (V3)", @@ -186,7 +191,8 @@ var tower = [ "speed": 3, "damage": 40, "health": 100, - "durability_reduction": 10 + "durability_reduction": 10, + "area_damage": false } ] diff --git a/scripts/towers/tower.gd b/scripts/towers/tower.gd index 68f09ad..4a02d5a 100644 --- a/scripts/towers/tower.gd +++ b/scripts/towers/tower.gd @@ -15,8 +15,7 @@ var damage: int = 0 var speed: int = 0 var shoot_timer: float = 0 var durability_reduction: int = 0 - -var is_shoot: bool = true +var area_damage: bool = false var enemies = [] @@ -32,6 +31,7 @@ func set_tower(id: int, placement_id): speed = config.tower[tower_id]['speed'] shoot_timer = config.tower[tower_id]['timer'] durability_reduction = config.tower[tower_id]['durability_reduction'] + area_damage = config.tower[tower_id]['area_damage'] func set_timer(): timer.wait_time = shoot_timer @@ -62,6 +62,8 @@ func _shoot(): bullet_instance.global_position = global_position bullet_instance.speed = speed bullet_instance.damage = damage + bullet_instance.area_damage = area_damage + bullet_instance.area_damage_target = enemies get_tree().current_scene.add_child(bullet_instance) health -= durability_reduction timer.start()