Fixed spacing, fixed enemy hitbox
This commit is contained in:
@@ -7,12 +7,12 @@ var speed = 3
|
||||
|
||||
func _ready():
|
||||
|
||||
look_vec = player.position - global_position
|
||||
look_vec = player.position - global_position
|
||||
|
||||
func _physics_process(delta):
|
||||
move = Vector2.ZERO
|
||||
move = move.move_toward(look_vec, delta)
|
||||
move = move.normalized() * speed
|
||||
position += move
|
||||
move = Vector2.ZERO
|
||||
move = move.move_toward(look_vec, delta)
|
||||
move = move.normalized() * speed
|
||||
position += move
|
||||
|
||||
|
||||
|
@@ -6,8 +6,11 @@
|
||||
[sub_resource type="CircleShape2D" id=1]
|
||||
radius = 4.47823
|
||||
|
||||
[node name="snowball_blue" type="Area2D" groups=["damage"]]
|
||||
collision_layer = 2
|
||||
[node name="snowball_blue" type="Area2D" groups=[
|
||||
"enemy_projectile_1",
|
||||
]]
|
||||
collision_layer = 0
|
||||
collision_mask = 2
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
|
@@ -1,15 +1,19 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://Sprites/Enemies/blue_snowman.png" type="Texture" id=1]
|
||||
[ext_resource path="res://Enemies/Snowman Enemy.gd" type="Script" id=2]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id=1]
|
||||
radius = 6.0
|
||||
height = 5.0
|
||||
radius = 1.5
|
||||
height = 3.0
|
||||
|
||||
[sub_resource type="CircleShape2D" id=2]
|
||||
radius = 58.0175
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id=3]
|
||||
radius = 6.0
|
||||
height = 5.0
|
||||
|
||||
[node name="snowmen_enemy" type="KinematicBody2D"]
|
||||
collision_layer = 2
|
||||
script = ExtResource( 2 )
|
||||
@@ -17,8 +21,10 @@ script = ExtResource( 2 )
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2( 0.556812, 0.44545 )
|
||||
[node name="Collision" type="CollisionShape2D" parent="."]
|
||||
light_mask = 0
|
||||
position = Vector2( 0.618717, 6.27557 )
|
||||
rotation = 1.5708
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="detection" type="Area2D" parent="."]
|
||||
@@ -31,6 +37,16 @@ shape = SubResource( 2 )
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
autostart = true
|
||||
|
||||
[node name="hitbox" type="Area2D" parent="." groups=[
|
||||
"enemy_hitbox_1",
|
||||
]]
|
||||
visible = false
|
||||
collision_layer = 4
|
||||
collision_mask = 2
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="hitbox"]
|
||||
shape = SubResource( 3 )
|
||||
|
||||
[connection signal="body_entered" from="detection" to="." method="_on_Area2D_body_entered"]
|
||||
[connection signal="body_exited" from="detection" to="." method="_on_Area2D_body_exited"]
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]
|
||||
|
@@ -1,15 +1,19 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://Sprites/Enemies/pink_snowman.png" type="Texture" id=1]
|
||||
[ext_resource path="res://Enemies/Snowman Enemy.gd" type="Script" id=2]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id=1]
|
||||
radius = 6.0
|
||||
height = 5.0
|
||||
radius = 1.5
|
||||
height = 3.0
|
||||
|
||||
[sub_resource type="CircleShape2D" id=2]
|
||||
radius = 56.0659
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id=3]
|
||||
radius = 6.0
|
||||
height = 5.0
|
||||
|
||||
[node name="snowmen_enemy" type="KinematicBody2D"]
|
||||
collision_layer = 2
|
||||
script = ExtResource( 2 )
|
||||
@@ -17,19 +21,34 @@ script = ExtResource( 2 )
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
[node name="Collision" type="CollisionShape2D" parent="."]
|
||||
light_mask = 0
|
||||
position = Vector2( 0.618717, 6.27557 )
|
||||
rotation = 1.5708
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="detection" type="Area2D" parent="."]
|
||||
visible = false
|
||||
collision_layer = 0
|
||||
collision_mask = 2
|
||||
|
||||
[node name="detection" type="CollisionShape2D" parent="detection"]
|
||||
visible = false
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
autostart = true
|
||||
|
||||
[node name="hitbox" type="Area2D" parent="." groups=[
|
||||
"enemy_hitbox_1",
|
||||
]]
|
||||
visible = false
|
||||
collision_layer = 4
|
||||
collision_mask = 2
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="hitbox"]
|
||||
shape = SubResource( 3 )
|
||||
|
||||
[connection signal="body_entered" from="detection" to="." method="_on_Area2D_body_entered"]
|
||||
[connection signal="body_exited" from="detection" to="." method="_on_Area2D_body_exited"]
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]
|
||||
|
@@ -6,10 +6,12 @@
|
||||
[sub_resource type="CircleShape2D" id=1]
|
||||
radius = 4.47823
|
||||
|
||||
[node name="snowball" type="Area2D" groups=["damage"]]
|
||||
collision_layer = 2
|
||||
collision_mask = 0
|
||||
[node name="snowball" type="Area2D" groups=[
|
||||
"enemy_projectile_1",
|
||||
]]
|
||||
monitoring = false
|
||||
collision_layer = 0
|
||||
collision_mask = 2
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
|
Reference in New Issue
Block a user