Repair Bunny Projectile Collisions
This commit is contained in:
parent
2c0a0673da
commit
ea3192a894
4 changed files with 22 additions and 4 deletions
|
@ -3,7 +3,7 @@
|
||||||
[ext_resource type="Script" path="res://Scripts/UI/SettingsMenu.gd" id="1_2rgd2"]
|
[ext_resource type="Script" path="res://Scripts/UI/SettingsMenu.gd" id="1_2rgd2"]
|
||||||
[ext_resource type="Script" path="res://Scripts/UI/Remaping/RemapController.gd" id="2_2f8ap"]
|
[ext_resource type="Script" path="res://Scripts/UI/Remaping/RemapController.gd" id="2_2f8ap"]
|
||||||
[ext_resource type="Script" path="res://Scripts/UI/Remaping/RemapButton.gd" id="2_4asaa"]
|
[ext_resource type="Script" path="res://Scripts/UI/Remaping/RemapButton.gd" id="2_4asaa"]
|
||||||
[ext_resource type="Theme" path="res://Assets/UI/Theme.tres" id="3_ajuuh"]
|
[ext_resource type="Theme" uid="uid://b0b3fxesfrpb7" path="res://Assets/UI/Theme.tres" id="3_ajuuh"]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_02uod"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_02uod"]
|
||||||
bg_color = Color(0.439216, 0.631373, 0.537255, 1)
|
bg_color = Color(0.439216, 0.631373, 0.537255, 1)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=10 format=3 uid="uid://cpl4tllohhyel"]
|
[gd_scene load_steps=11 format=3 uid="uid://cpl4tllohhyel"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://Scripts/EntitySystem/Bunny.gd" id="1_1kj2b"]
|
[ext_resource type="Script" path="res://Scripts/EntitySystem/Bunny.gd" id="1_1kj2b"]
|
||||||
[ext_resource type="Texture2D" uid="uid://df2fluk0dlqar" path="res://Assets/Sprites/Bunny/bad_bunny_spritesheet.png" id="2_v8p70"]
|
[ext_resource type="Texture2D" uid="uid://df2fluk0dlqar" path="res://Assets/Sprites/Bunny/bad_bunny_spritesheet.png" id="2_v8p70"]
|
||||||
|
@ -111,7 +111,12 @@ _data = {
|
||||||
"RESET": SubResource("Animation_mp212")
|
"RESET": SubResource("Animation_mp212")
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="Bunny" type="Node2D" node_paths=PackedStringArray("animation_player", "agent")]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_nil6g"]
|
||||||
|
radius = 11.0
|
||||||
|
|
||||||
|
[node name="Bunny" type="Area2D" node_paths=PackedStringArray("animation_player", "agent")]
|
||||||
|
collision_layer = 4
|
||||||
|
collision_mask = 0
|
||||||
script = ExtResource("1_1kj2b")
|
script = ExtResource("1_1kj2b")
|
||||||
animation_player = NodePath("BunnyAnimator")
|
animation_player = NodePath("BunnyAnimator")
|
||||||
agent = NodePath("NavigationAgent")
|
agent = NodePath("NavigationAgent")
|
||||||
|
@ -129,3 +134,6 @@ path_metadata_flags = 0
|
||||||
libraries = {
|
libraries = {
|
||||||
"": SubResource("AnimationLibrary_uuf00")
|
"": SubResource("AnimationLibrary_uuf00")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("CircleShape2D_nil6g")
|
||||||
|
|
|
@ -35,4 +35,5 @@ stream = ExtResource("5_njike")
|
||||||
[node name="Audio3" type="AudioStreamPlayer" parent="Audio Sources"]
|
[node name="Audio3" type="AudioStreamPlayer" parent="Audio Sources"]
|
||||||
stream = ExtResource("6_ky3xa")
|
stream = ExtResource("6_ky3xa")
|
||||||
|
|
||||||
|
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||||
[connection signal="body_entered" from="." to="." method="_on_collision"]
|
[connection signal="body_entered" from="." to="." method="_on_collision"]
|
||||||
|
|
|
@ -28,8 +28,17 @@ func _on_collision(body):
|
||||||
|
|
||||||
if collided_layer & map_collision_layer:
|
if collided_layer & map_collision_layer:
|
||||||
queue_free()
|
queue_free()
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
func _on_area_entered(area):
|
||||||
|
var collided_layer = null;
|
||||||
|
|
||||||
|
if(area.has_method("get_collision_layer")):
|
||||||
|
collided_layer = area.get_collision_layer()
|
||||||
|
|
||||||
if collided_layer & bunny_collision_layer:
|
if collided_layer & bunny_collision_layer:
|
||||||
var bunny = body as Bunny
|
var bunny = area as Bunny
|
||||||
bunny.damage(damage)
|
bunny.damage(damage)
|
||||||
queue_free()
|
queue_free()
|
||||||
pass
|
pass
|
||||||
|
|
Reference in a new issue