Enemy Dust Effect + Flying enemy aggro
This commit is contained in:
parent
3d940d26c0
commit
930ff3e2bb
|
@ -0,0 +1,4 @@
|
|||
extends Node2D
|
||||
|
||||
func _on_DustEffect8_tree_exited():
|
||||
queue_free()
|
|
@ -0,0 +1,46 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://Scenes/Effects/DustEffect.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://Scenes/Effects/EnemyDeathEffect.gd" type="Script" id=2]
|
||||
|
||||
[node name="EnemyDeathEffect" type="Node2D"]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="DustEffect" parent="." instance=ExtResource( 1 )]
|
||||
|
||||
[node name="DustEffect3" parent="." instance=ExtResource( 1 )]
|
||||
position = Vector2( -4, 4 )
|
||||
|
||||
[node name="DustEffect4" parent="." instance=ExtResource( 1 )]
|
||||
position = Vector2( -6, -2 )
|
||||
|
||||
[node name="DustEffect5" parent="." instance=ExtResource( 1 )]
|
||||
position = Vector2( -5, -7 )
|
||||
|
||||
[node name="DustEffect6" parent="." instance=ExtResource( 1 )]
|
||||
position = Vector2( 0, -5 )
|
||||
|
||||
[node name="DustEffect9" parent="." instance=ExtResource( 1 )]
|
||||
position = Vector2( 8, 2 )
|
||||
|
||||
[node name="DustEffect10" parent="." instance=ExtResource( 1 )]
|
||||
position = Vector2( -1, -10 )
|
||||
|
||||
[node name="DustEffect11" parent="." instance=ExtResource( 1 )]
|
||||
position = Vector2( -10, 3 )
|
||||
|
||||
[node name="DustEffect12" parent="." instance=ExtResource( 1 )]
|
||||
position = Vector2( -9, -7 )
|
||||
|
||||
[node name="DustEffect13" parent="." instance=ExtResource( 1 )]
|
||||
position = Vector2( 10, -4 )
|
||||
|
||||
[node name="DustEffect7" parent="." instance=ExtResource( 1 )]
|
||||
position = Vector2( 3, 5 )
|
||||
|
||||
[node name="DustEffect2" parent="." instance=ExtResource( 1 )]
|
||||
position = Vector2( 5, -3 )
|
||||
|
||||
[node name="DustEffect8" parent="." instance=ExtResource( 1 )]
|
||||
position = Vector2( 5, -8 )
|
||||
[connection signal="tree_exited" from="DustEffect8" to="." method="_on_DustEffect8_tree_exited"]
|
|
@ -1,5 +1,7 @@
|
|||
extends KinematicBody2D
|
||||
|
||||
const EnemyDeathEffect = preload("res://Scenes/Effects/EnemyDeathEffect.tscn")
|
||||
|
||||
export (int) var MAX_SPEED = 15
|
||||
|
||||
onready var stats = $EnemyStats
|
||||
|
@ -10,4 +12,5 @@ func _on_Hurtbox_hit(damage):
|
|||
stats.health -= damage
|
||||
|
||||
func _on_EnemyStats_enemy_died():
|
||||
Utils.instance_scene_on_main(EnemyDeathEffect, global_position)
|
||||
queue_free()
|
||||
|
|
|
@ -6,6 +6,9 @@ var MainInstances = ResourceLoader.MainInstances
|
|||
|
||||
onready var sprite = $Sprite
|
||||
|
||||
func _ready():
|
||||
set_physics_process(false)
|
||||
|
||||
func _physics_process(delta):
|
||||
var player = MainInstances.Player
|
||||
if player != null:
|
||||
|
@ -17,3 +20,7 @@ func chase_player(player, delta):
|
|||
motion = motion.clamped(MAX_SPEED)
|
||||
sprite.flip_h = global_position < player.global_position
|
||||
motion = move_and_slide(motion)
|
||||
|
||||
|
||||
func _on_VisibilityNotifier2D_screen_entered():
|
||||
set_physics_process(true)
|
||||
|
|
|
@ -47,16 +47,17 @@ shape = SubResource( 1 )
|
|||
autoplay = "Fly"
|
||||
anims/Fly = SubResource( 2 )
|
||||
|
||||
[node name="Hurtbox" parent="." index="3"]
|
||||
collision_layer = 8
|
||||
collision_mask = 0
|
||||
|
||||
[node name="Collider" parent="Hurtbox" index="0"]
|
||||
shape = SubResource( 3 )
|
||||
|
||||
[node name="Collider" parent="Hitbox" index="0"]
|
||||
shape = SubResource( 4 )
|
||||
|
||||
[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="." index="6"]
|
||||
position = Vector2( 7.15256e-07, -2.5 )
|
||||
scale = Vector2( 0.7, 0.65 )
|
||||
[connection signal="screen_entered" from="VisibilityNotifier2D" to="." method="_on_VisibilityNotifier2D_screen_entered"]
|
||||
|
||||
[editable path="Hurtbox"]
|
||||
|
||||
[editable path="Hitbox"]
|
||||
|
|
Loading…
Reference in New Issue