From d944bbf380b61eedc46bfca081685ee9765183b6 Mon Sep 17 00:00:00 2001 From: Moonshrike Date: Wed, 17 Nov 2021 23:34:37 +0200 Subject: [PATCH] deleting bot when is shoot --- .../scripts/shooting/Hyperbola/Hyperbolic_Bullet.gd | 5 ++++- source/assets/scripts/shooting/Line/Line_Bullet.gd | 5 +++-- .../assets/scripts/shooting/Parabola/Parabolic_Bullet.gd | 5 ++++- source/assets/scripts/shooting/Sine/Sine_Bullet.gd | 3 +++ source/assets/scripts/ts_bot_handlers/ts_bot_handlergd.gd | 2 +- .../shooting/Parabolic_Trajectory/Parabolic_Bullet.tscn | 8 ++------ source/entities/ts_bot/Bot_Bullet.gd | 1 - 7 files changed, 17 insertions(+), 12 deletions(-) diff --git a/source/assets/scripts/shooting/Hyperbola/Hyperbolic_Bullet.gd b/source/assets/scripts/shooting/Hyperbola/Hyperbolic_Bullet.gd index cc39981..7da0f94 100644 --- a/source/assets/scripts/shooting/Hyperbola/Hyperbolic_Bullet.gd +++ b/source/assets/scripts/shooting/Hyperbola/Hyperbolic_Bullet.gd @@ -30,5 +30,8 @@ func _process(delta): position += velocity * speed_hyper * delta -func _on_hitbox_body_entered(_body): +func _on_hitbox_body_entered(body): queue_free() + + if body.is_in_group('bot'): + body.queue_free() diff --git a/source/assets/scripts/shooting/Line/Line_Bullet.gd b/source/assets/scripts/shooting/Line/Line_Bullet.gd index fe0794f..b12acab 100644 --- a/source/assets/scripts/shooting/Line/Line_Bullet.gd +++ b/source/assets/scripts/shooting/Line/Line_Bullet.gd @@ -22,8 +22,9 @@ func _process(delta): position += velocity * speed_line * delta -func _on_hitbox_body_entered(_body): +func _on_hitbox_body_entered(body): queue_free() - + if body.is_in_group('bot'): + body.queue_free() diff --git a/source/assets/scripts/shooting/Parabola/Parabolic_Bullet.gd b/source/assets/scripts/shooting/Parabola/Parabolic_Bullet.gd index 02d623c..799b832 100644 --- a/source/assets/scripts/shooting/Parabola/Parabolic_Bullet.gd +++ b/source/assets/scripts/shooting/Parabola/Parabolic_Bullet.gd @@ -29,5 +29,8 @@ func _process(delta): position += velocity * speed_parab * delta -func _on_hitbox_body_entered(_body): +func _on_hitbox_body_entered(body): queue_free() + + if body.is_in_group('bot'): + body.queue_free() diff --git a/source/assets/scripts/shooting/Sine/Sine_Bullet.gd b/source/assets/scripts/shooting/Sine/Sine_Bullet.gd index 8ccdc41..cb246bf 100644 --- a/source/assets/scripts/shooting/Sine/Sine_Bullet.gd +++ b/source/assets/scripts/shooting/Sine/Sine_Bullet.gd @@ -23,3 +23,6 @@ func _on_hitbox_body_entered(body): if body.is_in_group("mobs"): body.queue_free() queue_free() + + if body.is_in_group('bot'): + body.queue_free() diff --git a/source/assets/scripts/ts_bot_handlers/ts_bot_handlergd.gd b/source/assets/scripts/ts_bot_handlers/ts_bot_handlergd.gd index bb57628..64cbad6 100644 --- a/source/assets/scripts/ts_bot_handlers/ts_bot_handlergd.gd +++ b/source/assets/scripts/ts_bot_handlers/ts_bot_handlergd.gd @@ -96,4 +96,4 @@ func shoot_bot(): var b = bullet.instance() get_parent().add_child(b) b.global_position = self.global_position - b.global_rotation = 360/rotationAmount + b.global_rotation = self.global_rotation#360/rotationAmount diff --git a/source/entities/shooting/Parabolic_Trajectory/Parabolic_Bullet.tscn b/source/entities/shooting/Parabolic_Trajectory/Parabolic_Bullet.tscn index c629678..8c7986e 100644 --- a/source/entities/shooting/Parabolic_Trajectory/Parabolic_Bullet.tscn +++ b/source/entities/shooting/Parabolic_Trajectory/Parabolic_Bullet.tscn @@ -7,15 +7,11 @@ radius = 9.85811 height = 35.0082 -[node name="player_character_bullet" type="Sprite" groups=[ -"Net", -]] +[node name="player_character_bullet" type="Sprite" groups=["Net"]] texture = ExtResource( 1 ) script = ExtResource( 2 ) -[node name="hitbox" type="Area2D" parent="." groups=[ -"Player_damager", -]] +[node name="hitbox" type="Area2D" parent="." groups=["Player_damager"]] [node name="CollisionShape2D" type="CollisionShape2D" parent="hitbox"] position = Vector2( 10.8253, -0.381073 ) diff --git a/source/entities/ts_bot/Bot_Bullet.gd b/source/entities/ts_bot/Bot_Bullet.gd index 20851f8..e310502 100644 --- a/source/entities/ts_bot/Bot_Bullet.gd +++ b/source/entities/ts_bot/Bot_Bullet.gd @@ -17,7 +17,6 @@ func follow_line_trajectory(): func _process(delta): - print(bot_rotation) follow_line_trajectory() time += delta position += velocity * speed_line * delta