Mob Death: Stop Movement and Remove Material
parent
185a87a828
commit
138584b335
|
@ -25,7 +25,7 @@ flip_h = true
|
|||
use_parent_material = true
|
||||
frames = ExtResource( 1 )
|
||||
animation = "idle"
|
||||
frame = 4
|
||||
frame = 1
|
||||
playing = true
|
||||
centered = false
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
[ext_resource path="res://res/shaders/colorize.tres" type="Material" id=3]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 3.5, 3.5 )
|
||||
extents = Vector2( 4, 4 )
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=2]
|
||||
extents = Vector2( 3.5, 9 )
|
||||
extents = Vector2( 7, 11 )
|
||||
|
||||
[sub_resource type="Animation" id=4]
|
||||
resource_name = "RESET"
|
||||
|
@ -48,7 +48,7 @@ tracks/0/loop_wrap = true
|
|||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 2 ),
|
||||
"times": PoolRealArray( 0, 0.9 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"update": 1,
|
||||
"values": [ true, false ]
|
||||
|
|
|
@ -129,7 +129,7 @@ func _physics_process(delta):
|
|||
velocity = move_and_slide(velocity * speed_multiplier)
|
||||
choose_target()
|
||||
|
||||
if target != null and is_instance_valid(target):
|
||||
if target != null and is_instance_valid(target) and not target.dead:
|
||||
target.material = outline_material
|
||||
|
||||
if recharge_timer >= get_recharge():
|
||||
|
|
|
@ -12,6 +12,7 @@ var frozen_time = 2
|
|||
var poisoned_time = 3
|
||||
var poisoned_damage = 5
|
||||
var poison_damage_timer = .0
|
||||
var death_position
|
||||
|
||||
var frozen = false
|
||||
|
||||
|
@ -22,6 +23,8 @@ func deal_damage(amount):
|
|||
|
||||
func death():
|
||||
dead = true
|
||||
$Sprite.playing = false
|
||||
death_position = self.global_position
|
||||
$Area2D.call_deferred("free")
|
||||
remove_from_group("enemy")
|
||||
material = empty_material
|
||||
|
@ -29,6 +32,7 @@ func death():
|
|||
|
||||
func _physics_process(delta):
|
||||
if dead:
|
||||
self.global_position = death_position
|
||||
dead_timer += delta
|
||||
$Sprite.modulate.a = 1 - (dead_timer / 2)
|
||||
if dead_timer >= 2.0:
|
||||
|
|
Loading…
Reference in New Issue